码迷,mamicode.com
首页 > 其他好文 > 详细

textcolor 设置selecter 报错: <item> tag requires a 'color' attribute or child tag defining a drawab

时间:2015-04-20 09:31:05      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:

如果是textview的textcolor属性设置成selecter,则需要这么写这个selecter:

<span style="font-size:14px;"><?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@color/navigation_menu_text_normal" android:state_focused="false" android:state_pressed="false" />
    <item android:color="@color/navigation_menu_text_pressed" android:state_pressed="true" />
    <item android:color="@color/navigation_menu_text_pressed" android:state_focused="true" />
</selector></span>

注意,是android:color

如果是background属性,则需要这么写这个selecter:

<span style="font-size:14px;"><?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@mipmap/arrow_menu_normal" android:state_focused="false" android:state_pressed="false" />
    <item android:drawable="@mipmap/arrow_menu_pressed" android:state_pressed="true" />
    <item android:drawable="@mipmap/arrow_menu_pressed" android:state_focused="true" />
</selector></span>

注意,是android:drawable

textcolor 设置selecter 报错: <item> tag requires a 'color' attribute or child tag defining a drawab

标签:

原文地址:http://blog.csdn.net/u013173289/article/details/45134267

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!