btn.setTextColor(mContext.getResources()
.getColor(R.color.selector_sku_btn_tv));
这个是定义在String里的
如果是xml里的话要
XmlPullParser xrp = mContext.getResources()
.getXml(R.color.selector_sku_btn_tv);
ColorStateList csl;
try {
csl = ColorStateList.createFromXml(mContext.getResources(),
xrp);
btn.setTextColor(csl);
} catch (XmlPullParserException e) {
}
转载于:https://blog.51cto.com/mama100tech/1672101