Convert hex color value ( #ffffff ) to integer value

前端 未结 9 1042
孤城傲影
孤城傲影 2020-12-13 01:26

I am receiving hex color values from a server (in this form, #xxxxxx , example #000000 for black)

How do I convert this to an integer value

9条回答
  •  無奈伤痛
    2020-12-13 02:11

    The real answer is to use:

    Color.parseColor(myPassedColor) in Android, myPassedColor being the hex value like #000 or #000000 or #00000000.

    However, this function does not support shorthand hex values such as #000.

提交回复
热议问题