一、设置控件背景颜色用setBackgroundColor
mView.findViewById(resId).setBackgroundColor(Color.GREEN);
二、获取控件背景颜色方法
Button button = (Button) findViewById(R.id.my_button);
ColorDrawable buttonColor = (ColorDrawable) button.getBackground();
int colorId = buttonColor.getColor();
三、实际应用,检测所有的控件背景是否都是某一种颜色。
四、参考文章