1 在res的drawable目录下 新建xml文件 在布局文件中设置button的background属性为这个xml
2 <?xml version="1.0" encoding="utf-8"?>
3 <selector xmlns:android="http://schemas.android.com/apk/res/android">
4
5 <item android:drawable="@drawable/function_greenbutton_pressed" android:state_pressed="true"/>
6
7 <item android:drawable="@drawable/function_greenbutton_pressed" android:state_focused="true"/>
8
9 <item android:drawable="@drawable/function_greenbutton_normal"/>
10
11 </selector>
状态选择器
转载于:https://www.cnblogs.com/YyuTtian/p/5379106.html