我试图使用ColorStateList更改RadioGroup的颜色,但遇到了一些基本错误。我可以不使用RadioGroup而更改ColorStateList按钮的颜色吗?有更简单的方法吗?
我已经导入了以下内容,但仍然得到了“无法解析符号”。
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ColorDrawable;我试图在下面实现ColorStateList,不确定是否正确,但首先我需要修复‘无法解决符号错误’:
if (Item.getCar()=='Audi'){
ColorStateList csl = new ColorStateList(
new int[][]{
new int[]{android.R.attr.state_enabled}, //disabled
new int[]{android.R.attr.state_enabled} //enabled
},
new int[] {
Color.BLACK //disabled
,Color.BLUE //enabled
}
);
int textColor = Color.parseColor("#000000");
x.radioGroup.set(ColorStateList.valueOf(textColor));任何试图让ColorStateList工作的帮助都是非常感谢的。
发布于 2016-06-17 03:59:26
您需要导入以下内容
import android.content.res.ColorStateList;
import android.graphics.Color;对我来说很管用。
https://stackoverflow.com/questions/37872847
复制相似问题