TextView中设置selector不生效
给TextView的selector设置属性android:state_pressed
错误的的selector代码示例:
javascript
// selector不生效代码示例
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/yt_bg_normal_btn_tire" android:state_selected="false"/>
<item android:drawable="@drawable/yt_bg_press_btn_tire" android:state_selected="true"/>
</selector>
正确的selector代码示例:
javascript
// selector有效代码示例
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/yt_bg_normal_btn_tire" android:state_pressed="false"/>
<item android:drawable="@drawable/yt_bg_press_btn_tire" android:state_pressed="true"/>
</selector>