Create a new color drawable

后端 未结 6 773
时光说笑
时光说笑 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 13:09

    I think you have to use :

    public static int parseColor (String colorString)

    Added in API level 1 Parse the color string, and return the corresponding color-int. If the string cannot be parsed, throws an IllegalArgumentException exception. Supported formats are: #RRGGBB #AARRGGBB red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray, darkgray, grey, lightgrey, darkgrey, aqua, fuschia, lime, maroon, navy, olive, purple, silver, teal

提交回复
热议问题