Create a new color drawable

后端 未结 6 775
时光说笑
时光说笑 2021-01-30 12:43

I am trying to convert a hex value to an int so I can create a new color drawable. I\'m not sure if this is possible, but according to the documentation, it should. It plainly a

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-30 12:48

    For using with ContextCompat and rehuse the color you can do something like this:

    ColorDrawable colorDrawable = new ColorDrawable(ContextCompat.getColor(this, R.color.white));
    

提交回复
热议问题