Android:state_selected 控件選中狀態,能夠爲true或false android
android:state_focused 控件得到焦點狀態,能夠爲true或false .net
android:state_pressed 控件點擊狀態,能夠爲true或false orm
android:state_enabled 控件使能狀態,能夠爲true或false xml
android:state_checkable 控件可勾選狀態,能夠爲true或false 圖片
android:state_checked 控件勾選狀態,能夠爲true或falseutf-8
btn_enabled.xmlget
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> it
<!-- 默認 -->
<item android:state_enabled="true">
<color android:color="#e25050" />
</item>
<item android:state_enabled="false">
<color android:color="#908e8e" />
</item>
</selector>io
btn_pressed.xmlclass
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/btn_arrow_left_pressed" /> <item android:state_window_focused="true" android:state_focused="true" android:drawable="@drawable/btn_arrow_left_pressed" /> <item android:state_window_focused="false" android:state_focused="false" android:drawable="@drawable/btn_arrow_left_normal" /> </selector>