Android: java.lang.IllegalArgumentException: Unknown color

前端 未结 3 948
小鲜肉
小鲜肉 2020-12-18 18:35

I\'m getting the above error when I try to run the following code:

int colourInt = Color.parseColor(colour.getHexValue());

The offending he

3条回答
  •  没有蜡笔的小新
    2020-12-18 19:13

    I want to add something with the accepted answer. I had similar exception while I'm trying to use black color using Color.parseColor("#000") which start with #.So the thing is inside your parseColor method it only accept a six digit hex code of color,If it is less or greater than this its give the exception.I change it like #121212(black) this and it works for me.

提交回复
热议问题