Access resource defined in theme and attrs.xml android

前端 未结 5 1960
情歌与酒
情歌与酒 2020-12-04 21:55

I have a scenario in which I want to set a Drawable depending upon the theme defined.

To explain this further, Here is what I have in code:

5条回答
  •  执念已碎
    2020-12-04 22:42

    If you are using support / design library easier way to get drawables now is -

    Context.getDrawable(int)
    

    or

    ContextCompat.getDrawable(Context, int)
    

    reference - https://plus.google.com/+BenjaminWeiss/posts/M1dYFaobyBM

提交回复
热议问题