Android getResources().getDrawable() deprecated API 22

后端 未结 14 1905
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 07:14

With new android API 22 getResources().getDrawable() is now deprecated. Now the best approach is to use only getDrawable().

What changed? <

14条回答
  •  礼貌的吻别
    2020-11-22 07:53

    You can use

    ContextCompat.getDrawable(getApplicationContext(),R.drawable.example);
    

    that's work for me

提交回复
热议问题