[Android Studio] 如何在Button控件中实现包边效果
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="669dp"
android:background="#00000000">
<Button
android:id="@+id/guide_btn_start"
android:layout_width="200dp"
android:layout_height="45dp"
android:background="@drawable/btn_onclick"
android:text="开启音乐之旅"
android:textColor="#03A9F4"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginBottom="10dp"
android:layout_gravity="center_horizontal"/>
</LinearLayout>
--------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape android:shape="rectangle" android:visible="true">
<solid android:color="#00000000"/>
<!--颜色-->
<corners android:radius="30dp"/>
<!--标准圆角-->
<stroke
android:width="2dp"
android:color="#03A9F4"/>
<!--边框色-->
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle" android:visible="true">
<solid android:color="#00000000"/>
<corners android:radius="30dp"/>
<stroke
android:width="2dp"
android:color="#03A9F4"/>
</shape>
</item>
</selector>
---------------------------------------------------------------------------------------
效果如下: