Android getResources().getDrawable() deprecated API 22

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

    For some who still got this issue to solve even after applying the suggestion of this thread(i used to be one like that) add this line on your Application class, onCreate() method

    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)

    As suggested here and here sometimes this is required to access vectors from resources especially when you're dealing with menu items, etc

提交回复
热议问题