我不知道如何获取按钮文本的当前颜色。我知道可能是这样,但无法完全弄清楚参数。
public static int getTextColor (Context context, TypedArray attrs, int def)...
基本上我正在尝试这样做
if(text is RED)
{make text BLACK}
else
{make text RED}
我知道如何设置文本颜色。
try this
ColorStateList mList = mButton.getTextColors();
int color = mList.getDefaultColor();
switch(color)
{
case Color.RED:
mButton.setTextColor(Color.BLACK);
break;
case Color.BLACK:
mButton.setTextColor(Color.RED);
break;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)