【发布时间】:2014-12-22 18:18:46
【问题描述】:
我在选择器标签内使用以下 xml 标签:
<item android:state_enabled="true" android:color="@color/red"/>
<item android:color="@color/black"/>
我使用这个选择器来指定 TextView 的 textColor(文件名为 = country_code_spinner_item)。
此 TextView 在以下 ArrayAdapter 中使用:
ArrayList<String> countrySpinnerOptions = new ArrayList<>(
CountryData.getInstance().getSortedCountryCodes());
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.country_code_spinner_item,
countrySpinnerOptions)
This adapter is added to a **Spinner Object**.
Inside the file named = **country_code_spinner_item**
I have specified : **android:enabled="false"**
and **android:textColor="@color/country_code_selector"**
Here country_code_selector is the file in which i have specified :
**<item android:state_enabled="true" android:color="@color/red"/>**
现在,当这个 TextView 将被渲染时,启用的标签被设置为 false 硬编码。 TextView 的 textColor 应设置为黑色。但是我看到 textColor 是红色的,尽管我已经指定了 android:enabled = false ,然后应该在选择器中选择第二个选项。
我基本上希望将 TextView 中的文本颜色默认保持为黑色,并且当 TextView 被点击时(这是一个微调器对象),我希望将颜色永久更改为红色。 如何使用
对我来说似乎并不直接感谢您的帮助
【问题讨论】:
标签: android