setbackgroundcolor
1.setbackgroundcolor(0xFFFF0000);
2.setBackgroundColor(Color.BLACK);
public class Color {
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;
3.setBackgroundColor(Color.rgb(0, 200, 0));
4.textview.setTextColor(Color.rgb(0, 200, 0));
5.textview.setTextColor(Color.parseColor("#234234"));
6.textview.setTextColor(getresources().getColor(R.color.white));
7.textview.setTextColor(Color.BLACK);
相关阅读
Android——动态设置view背景颜色setBackgroundColor
setBackgroundColor 用于动态设置view背景颜色 今天写代码的时候遇到个小问题 动态设置的时候用Color.GRAY,系统自己带着的颜色