This is done by layering several pictures to achieve the border effect.
In the Res directory under the drawable directory (no new) to build an XML file selected Layer-list.
<?xml version= "1.0" encoding= "UTF-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android > <!--is related to the order. The outermost layer must be placed at the front. The innermost layer is placed inside, otherwise it will be obscured. Also is related to the size of the value set in item- <!--outermost- <item> <shape> <solid android:color= "# 1e90ff "/> </shape> </item> <!--mid-and <item android:bottom=" 15DP " android:left=" 15DP " android:right=" 15DP " android:top=" 15DP "> <shape> < Solid android:color= "#ffffff"/> </shape> </item> <!--innermost-- <item android:bottom= "30DP" android:left= "30DP" android:right= "30DP" android:top= "30DP" > <shape> <solid android:color= "#bebebe"/> </shape> </item></ Layer-list>
Layout file:
<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools " android:layout_width=" match_parent " android:layout_height=" Match_parent " tools:context= ". Mainactivity " android:orientation=" horizontal " > <button android:id=" @+id/main_button " android:layout_width= "match_parent" android:layout_height= "137DP" android:background= "@drawable /buttonl " android:text=" Button01 "/></linearlayout>
Effect:
Chapter Three, setting the button border (Android)