【发布时间】:2012-12-14 16:04:20
【问题描述】:
我正在尝试使用以下代码为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>
但是,颜色始终显示为red,而不是theme colors。如果我输入硬编码颜色,一切似乎都正常。 (例如<item android:state_enabled="false" android:color="#666666" />)。
问题是什么以及如何解决?附言如果有人知道如何为列表中的禁用项目设置主题的默认禁用颜色,请分享,这就是我想要实现的。谢谢。
【问题讨论】:
-
我有同样的问题,在 4.1 上可以重现,但在较新的版本上似乎很好(例如黑色主题上的黑色)。
?android:attr/textColorPrimaryInverse看起来是红色的,但它不应该。我将主题中的android:textColorPrimaryInverse重新定义为自定义选择器,但它仍然是红色的。 -
您找到解决方案了吗?我正在尝试使用带有 ?android:attr/textColor 的选择器并遇到类似的问题
标签: android android-layout android-listview android-theme