1. 画一个背景的xml,圆角,背景填充色,边框色
<shapexmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"><cornersandroid:radius="25dp"/>
<strokeandroid:width="1dp"
android:color="@color/gray"/>
<solidandroid:color="@color/white"/>
</shape>
2. 按钮触摸,点击时切换背景图片
<?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/btn_loginselect" />
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/btn_login" />
<item android:state_focused="true" android:drawable="@drawable/btn_loginselect" />
<item android:state_focused="false" android:drawable="@drawable/btn_login" />
</selector>
3.RadioButton 被选择时改变背景
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false" android:drawable="@drawable/bg_radiobutton_speed" /> <item android:state_checked="true" android:drawable="@drawable/bg_radiobutton_speed_select" /> </selector>