做法就是做一個SELECTOR,但是關鍵是配置裏邊的參數。
單純設置PRESSED只能有點擊的效果
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/categoryselectbar2" android:state_window_focused="true"/>
<item android:drawable="@drawable/categoryselectbarclicked2" android:state_checked="false"/>
<item android:drawable="@drawable/categoryselectbar2" android:state_checked="true"/>
</selector>
要用到CHECKED和FOCUSED兩個參數