android使用shape做selector按钮按下和弹起的动画

时间:2023-12-25 00:05:49
平时效果:
android使用shape做selector按钮按下和弹起的动画
按下效果:
android使用shape做selector按钮按下和弹起的动画
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>