学习XMLDrawable
button_beat_box.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/button_beat_box_pressed" android:state_pressed="true"/> <item android:drawable="@drawable/button_beat_box_normal"/> </selector>
button_beat_box_normal.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="@color/dark_blue"/> </shape>
button_beat_box_pressed.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="oval"> <solid android:color="@color/red"/> </shape> </item> <item> <shape android:shape="oval"> <stroke android:width="4dp" android:color="@color/dark_red"/> </shape> </item> </layer-list>