当我对一个
有什么想法吗?
TextView
对象调用setEnabled(false)
方法时,文字颜色并不会改变。我期望它应该会变成灰色。如果我在XML文件中删除android:textColor
这一行的代码,那么文字颜色就会恢复正常。有什么想法吗?
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/disabled_color" />
<item android:color="@color/normal_color"/>
</selector>
<TextView
android:text="whatever text you want"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/example" />