在drawable里面创建button_boost.xml
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
android:color="@color/blue_boost"
android:width="1dp"/>
android:radius="20dp" />
button_boost_press.xml
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
android:color="@color/blue_boost" //外圈为blue_boost
android:width="1dp"/> //空心外圈宽度为1dp
android:color="@color/blue_boost_press" /> //矩形框里实心颜色为blue_boost_press
android:radius="20dp" /> //矩形边角弧度半径
selecter器
在drawable中建立button_selector.xml
xmlns:android="http://schemas.android.com/apk/res/android">
android:drawable="@drawable/button_boost"android:state_pressed="false" /> //不点击时的显示图片
android:drawable="@drawable/button_boost_press"android:state_pressed="true" /> //点击时的显示图片
使用
android:id="@+id/clean"
style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/button_selector"
android:ellipsize="end"
android:gravity="center"
android:paddingEnd="25dp"
android:paddingStart="25dp"
android:singleLine="true"
android:textColor="#444444"
android:textAllCaps="false"
android:textSize="@dimen/main_tv_title_text_size" />