Android studio中关于颜色的定义;

  1. 用8位十六进制数描述(ARGB)Alpha透明度,R红色,G绿色,B蓝色.数值在0~255之间(00~ff),例如#FF99CC00,(FF)不透明,99,CC,00红绿蓝的颜色值
  2. 用6位十六进制数描述RGB值,无透明度描述.
  3. 在app中的value目录下有color.xml文件里面封装好了颜色变量例如
    	public static final int BLACK = 0xFF000000;
    	public static final int DKGRAY = 0xFF444444;
    	public static final int GRAY = 0xFF888888;
    	public static final int LTGRAY = 0xFFCCCCCC;
    	public static final int WHITE = 0xFFFFFFFF;
    	public static final int RED = 0xFFFF0000;
    	public static final int GREEN = 0xFF00FF00;
    	public static final int BLUE = 0xFF0000FF;
    	public static final int YELLOW = 0xFFFFFF00;
    	public static final int CYAN = 0xFF00FFFF;
    	public static final int MAGENTA = 0xFFFF00FF;
    	public static final int TRANSPARENT = 0;
    

4.定义color为某颜色变量 - int color= 0xff00ff00; - int color=Color.argb(127,255,0,255); - int color=Color.parseColor("#00CCFF"); 5.Java代码中的设置TextView颜色 - textView.setTextColor(Color.RED); //调用Color文件中的 - textView.setTextColor(0xffff0000); //八进制颜色 - textView.setTextColor(Color.argb(127,255,0,255));颜色转换方法

END