android使用shape做selector按钮按下和弹起的动画
平时效果:
![](https://images2015.cnblogs.com/blog/554581/201510/554581-20151019152315036-1352182526.png)
按下效果:
![](https://images2015.cnblogs.com/blog/554581/201510/554581-20151019152315317-511587520.png)
selector代码:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"><shape> <solid android:color="@color/color_E9E9E9"/> <!-- 描边 --> <stroke android:width="1dp" android:color="@color/color_DDDDDD" /> <!-- 圆角 --> <corners android:radius="0dp" /> </shape></item> <item android:state_focused="true"><shape> <stroke android:width="1dp" android:color="@color/color_DDDDDD" /> <corners android:radius="0dp" /> </shape></item> <item><shape> <solid android:color="@color/color_F7F7F7"/> <stroke android:width="1dp" android:color="@color/color_DDDDDD" /> <corners android:radius="0dp" /> </shape></item> </selector>