Android getResources().getDrawable() deprecated API 22

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

    Build.VERSION_CODES.LOLLIPOP should now be changed to BuildVersionCodes.Lollipop i.e:

    if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) {
        this.Control.Background = this.Resources.GetDrawable(Resource.Drawable.AddBorder, Context.Theme);
    } else {
        this.Control.Background = this.Resources.GetDrawable(Resource.Drawable.AddBorder);
    }
    

提交回复
热议问题