Android编程之控件状态配置文件实例
内容摘要
本文实例讲述了Android编程之控件状态配置文件。分享给大家供大家参考,具体如下:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 无状态
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 无状态
文章正文
本文实例讲述了Android编程之控件状态配置文件。分享给大家供大家参考,具体如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | <selector xmlns:android= "http://schemas.android.com/apk/res/android" > <!-- 无状态时 --> <item android:state_focused= "false" android:state_selected= "false" android:state_pressed= "false" android:state_enabled= "true" android:drawable= "@drawable/blue" /> <!-- 选中状态 --> <item android:state_focused= "false" android:state_selected= "true" android:state_pressed= "false" android:state_enabled= "true" android:drawable= "@drawable/blue" /> <!-- 获得焦点 --> <item android:state_focused= "true" android:state_selected= "false" android:state_pressed= "false" android:state_enabled= "true" android:drawable= "@drawable/blue" /> <!-- 按下时的状态 --> <item android:state_focused= "false" android:state_selected= "false" android:state_pressed= "true" android:state_enabled= "true" android:drawable= "@drawable/blue" /> </selector> |
希望本文所述对大家Android程序设计有所帮助。
代码注释