Android getResources().getDrawable() deprecated API 22

后端 未结 14 2097
隐瞒了意图╮
隐瞒了意图╮ 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 08:08

    If you are targeting SDK > 21 (lollipop or 5.0) use

    context.getDrawable(R.drawable.your_drawable_name)
    

    See docs

提交回复
热议问题