应用场景:app常见样式,点击buttonview是需要其变颜色
首先:在drawable文件夹下创建一个xml文件selector_btn_click_bg
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/input_phone" android:state_enabled="true" android:state_window_focused="false"/>
<item android:drawable="@drawable/input_phone" android:state_enabled="false"/>
<item android:drawable="@drawable/button_shap" android:state_pressed="true"/>
<item android:drawable="@drawable/input_phone" android:state_focused="true"/>
</selector>
此时item节点中android:drawable一定会报错:
接着在drawable文件夹下再创建两个文件一个是( input_phone.xml ) ( button_shap.jp