码迷,mamicode.com
首页 > 移动开发 > 详细

android 控件在不同状态下的内容样式与背景样式

时间:2015-06-15 12:49:53      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

1 控件内容(如字体颜色)在不同状态下有不同的表现色
ref:http://developer.android.com/guide/topics/resources/color-list-resource.html
res/color/radio_state.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:color="hex_color"
        android:state_pressed=["true" | "false"]
        android:state_focused=["true" | "false"]
        android:state_selected=["true" | "false"]
        android:state_checkable=["true" | "false"]
        android:state_checked=["true" | "false"]
        android:state_enabled=["true" | "false"]
        android:state_window_focused=["true" | "false"] />
</selector>

2. 控件背景(背景样式与颜色)在不同状态下的不同表现结果:
ref:http://developer.android.com/guide/topics/resources/drawable-resource.html
res/drawable/radio_state.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
    android:constantSize=["true" | "false"]
    android:dither=["true" | "false"]
    android:variablePadding=["true" | "false"] >
    <item
        android:drawable="@[package:]drawable/drawable_resource"
        android:state_pressed=["true" | "false"]
        android:state_focused=["true" | "false"]
        android:state_hovered=["true" | "false"]
        android:state_selected=["true" | "false"]
        android:state_checkable=["true" | "false"]
        android:state_checked=["true" | "false"]
        android:state_enabled=["true" | "false"]
        android:state_activated=["true" | "false"]
        android:state_window_focused=["true" | "false"] />
</selector>

 

android 控件在不同状态下的内容样式与背景样式

标签:

原文地址:http://www.cnblogs.com/atwind/p/4576782.html

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