【问题标题】:Android Styles.xml can't find @drawable selector for TextView textColorAndroid Styles.xml 找不到 TextView textColor 的 @drawable 选择器
【发布时间】:2014-08-13 15:38:19
【问题描述】:

我有一个 TextView。我有一个选择器可以在按下时更改文本颜色。 如果我引用选择器内联(如下所示),它可以工作。

<TextView style="@style/DefaultLinkText" android:textColor="@drawable/tmp_hyperlink_textColor"/>

如果我将内联引用移动到 Styles.xml 中的样式中,则找不到它。

<style name="DefaultLinkText">
 <item name="android:clickable">true</item>
 <item name="android:layout_height">wrap_content</item>
 <item name="android:layout_width">wrap_content</item>
 <item name="android:textColor">@drawable/tmp_hyperlink_textColor</item>
 <item name="android:ellipsize">end</item>
</style>

任何想法为什么它找不到我的可绘制选择器?我在我的样式中引用了其他可绘制对象,但它们用于背景而不是 textColor。

【问题讨论】:

    标签: android textview xamarin android-drawable android-styles


    【解决方案1】:

    经过大量搜索...我发现我正确引用了它,但它不喜欢文件名! 所以我改变了我的文件名: tmp_hyperlink_textColor 到: tmp_hyperlink_text_color

    它不喜欢文件名中的 textColor 名称!所以我必须记住用小写下划线命名所有xml文件。

    【讨论】:

      猜你喜欢
      • 2014-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-10
      • 1970-01-01
      • 2012-06-28
      相关资源
      最近更新 更多