Android textColor选择器

Nul*_*ion 5 android android-layout android-listview android-theme

我正在尝试TextView使用以下代码为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="?android:attr/textColorTertiary" />
    <item android:color="?android:attr/textColorPrimary"/>
</selector>
Run Code Online (Sandbox Code Playgroud)

但是,颜色似乎总是red代替那些theme colors.如果我把硬编码的颜色,一切似乎都很好.(例如<item android:state_enabled="false" android:color="#666666" />).

有什么问题以及如何解决?PS如果任何人知道如何设置列表中禁用的项目主题的默认禁用颜色,请分享,这就是我想要的目的.谢谢.

pro*_*spk -2

据我所知,您可能必须在选择器中使用 3 种状态。

state enabled
state focused
state pressed 
Run Code Online (Sandbox Code Playgroud)

正是按照这个顺序。这可能有帮助