您的位置:首页 > 其它

textView字体颜色根据不同状态显示不同颜色

2013-07-22 10:42 549 查看
XML file saved at
res/color/button_text.xml
:

<?xml version="1.0" encoding="utf-8"?>
<selectorxmlns:android="http://schemas.android.com/apk/res/android">
<itemandroid:state_pressed="true"
android:color="#ffff0000"/><!-- pressed -->
<itemandroid:state_focused="true"
android:color="#ff0000ff"/><!-- focused -->
<itemandroid:color="#ff000000"/><!-- default -->
</selector>

This layout XML will apply the color list to a View:

<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/button_text"
android:textColor="@color/button_text"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: