Android: Color To Int conversion

前端 未结 5 1160
时光说笑
时光说笑 2020-12-06 03:56

This might be a stupid question but I\'m surprised that Paint class has no setColor(Color c) method. I want to do the following:

pu         


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-06 04:29

    Any color parse into int simplest two way here:

    1) Get System Color

    int redColorValue = Color.RED;
    

    2) Any Color Hex Code as a String Argument

    int greenColorValue = Color.parseColor("#00ff00")
    

    MUST REMEMBER in above code Color class must be android.graphics...!

提交回复
热议问题