扁平化按钮"
效果图:
代码:
1 <?xml version="1.0" encoding="utf-8"?> 2 <selector xmlns:android="http://schemas.android.com/apk/res/android"> 3 <item android:state_pressed="true"> 4 <shape> 5 <solid android:color="#79a84b"/> 6 <corners android:radius="8dp"/> 7 </shape> 8 </item> 9 <item android:state_pressed="false"> 10 <shape > 11 <solid android:color="#9ad060"/> 12 <corners android:radius="8dp"/> 13 </shape> 14 </item> 15 </selector>
设置背景即可(Android自定义button样式,参考:http://blog.csdn.net/maigan323/article/details/7026644)。