设置组件的字体颜色直接使用.setTextColor(R.color. x),你会发现并不能改变字体颜色。
而想改变颜色必须使用
botton.setTextColor(getResources().getColorStateList(R.color.orange_text));
本文介绍了一种在Android中设置按钮字体颜色的正确方法。通常,直接使用setTextColor(R.color.x)可能无法生效,正确的做法是使用button.setTextColor(getResources().getColorStateList(R.color.orange_text));来实现颜色的更改。
设置组件的字体颜色直接使用.setTextColor(R.color. x),你会发现并不能改变字体颜色。
而想改变颜色必须使用
botton.setTextColor(getResources().getColorStateList(R.color.orange_text));
3万+

被折叠的 条评论
为什么被折叠?