我需要改变时,状态变化(压,聚焦)文本颜色...如何设置TEXTCOLOR使用setTextColor(ColorsStateList颜色)
如何设置使用ColorsStateList一个TextView的文本颜色?
编辑解决:
textView.setTextColor (new ColorStateList (
new int [] [] {
new int [] {android.R.attr.state_pressed},
new int [] {android.R.attr.state_focused},
new int [] {}
},
new int [] {
Color.rgb (255, 128, 192),
Color.rgb (100, 200, 192),
Color.White
}
));
Change Background Color of TextView on Click
你看过吗? http://stackoverflow.com/questions/3506319/android-linearlayout-with-color-resource-what-am-i-doing-wrong –
你的问题是ambiguous-你只是寻找的教程使用ColorStateList?你有没有搜索过? http://stackoverflow.com/questions/3827416/how-to-define-colorstatelist-for-textview –
是的,但我不能使用XML。我需要做这个编程 – Rodrigo