2016年8月11日 星期四

why selector not work?

5.why selector not work?

not work

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:drawable="@color/colorPrimaryDark" />
   <item android:drawable="@color/buttonPressColor" android:state_pressed="true" />
</selector>


work

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:drawable="@color/colorPrimaryDark" android:state_pressed="false"/>
   <item android:drawable="@color/buttonPressColor" android:state_pressed="true" />
</selector>