setBackgroundDrawable() deprecated

前端 未结 11 1634
长发绾君心
长发绾君心 2020-12-03 00:18

So my sdk goes from 15 to 21 and when I call setBackgroundDrawable(), Android Studio tells me that it\'s deprecated.

I thought of going around it using:

11条回答
  •  不思量自难忘°
    2020-12-03 01:06

    Correct as of 23th November 2018

    Kotlin:

    view.background = resources.getDrawable(R.drawable.ic_image,theme)
    

    If you include the Theme parameter.

提交回复
热议问题