1.给Button设置属性:
android:background="@drawable/btn"
2.在drawable文件夹中新建btn.xml
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
//点击按钮时的效果
<item android:state_pressed="true" android:drawable="@drawable/equal_button_click" />
//正常状态效果
<item android:drawable="@drawable/equal_button_normal" />
</selector>
2.在valuse/drawables.xml中添加(没有就新建)
//颜色可自定义
<item type="drawable" name="equal_button_normal">#FFFF6600</item>
<item type="drawable" name="equal_button_click">#FFCD3700</item>