转载记录:http://www.51sjk.com/Upload/Articles/1/0/248/248892_20210624001009022.html
在drawable 新建一个xml 文件
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 圆角深红色按钮 -->
<solid android:color="#7FFFAA"/>
<corners android:radius="8dip"/>
</shape>
</item>
<item android:state_pressed="false">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 圆角红色按钮 -->
<solid android:color="#16BC05"/>
<corners android:radius="8dip"/>
</shape>
</item>
</selector>
样式: