@rawable/item_sleclected_btn
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/item_background_normal" android:state_focused="true"/> <item android:drawable="@drawable/item_background_focus" android:state_focused="false"/> </selector>
@drawable/item_background_normal `
<corners
android:bottomLeftRadius="@dimen/radius_default"
android:bottomRightRadius="@dimen/radius_default"
android:topLeftRadius="@dimen/radius_default"
android:topRightRadius="@dimen/radius_default"/>
<padding
android:bottom="@dimen/cibn_view_stroke_padding"
android:left="@dimen/cibn_view_stroke_padding"
android:right="@dimen/cibn_view_stroke_padding"
android:top="@dimen/cibn_view_stroke_padding"/>
`
@drawable/item_background_focus
`
<corners
android:bottomRightRadius="@dimen/radius_default"
android:bottomLeftRadius="@dimen/radius_default"
android:topLeftRadius="@dimen/radius_default"
android:topRightRadius="@dimen/radius_default"/>
<padding
android:bottom="@dimen/cibn_view_stroke_padding"
android:left="@dimen/cibn_view_stroke_padding"
android:right="@dimen/cibn_view_stroke_padding"
android:top="@dimen/cibn_view_stroke_padding"/>
最后配置 android:background="@drawable/item_sleclected_btn"<androidx.appcompat.widget.AppCompatButton
android:layout_marginTop="@dimen/dp_50"
android:layout_width="300dp"
android:layout_height="@dimen/dp_50"
android:text="登录"
android:gravity="center"
android:textStyle="bold"
android:onClick="onLogin"
android:textSize="@dimen/dp_18"
android:textColor="@color/white"
android:background="@drawable/item_sleclected_btn"
/>`