The border and border effects are often used in XML and summarized here.
3.border (Border and border effect)
(1) Right angle border line
<linearlayout
Android:layout_width= "200DP"
android:layout_height= "30DP"
Android:layout_margin= "10DP"
android:orientation= "Vertical"
android:background= "@drawable/border_c"
>
</LinearLayout>
Border_c.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<shape xmlns:android= "Http://schemas.android.com/apk/res/android" >
<!--fill Color-
<solid android:color= "@color/listitem_green"/>
<!--border width, color---
<stroke
Android:width= "0.1DP"
Android:color= "@color/black"/>
<!--radians of 4 angles set--
<corners
Android:topleftradius= "0.0dip"
Android:toprightradius= "0.0dip"
Android:bottomleftradius= "0.0dip"
Android:bottomrightradius= "0.0dip"
/>
</shape>
(2) Fillet border line
<linearlayout
Android:layout_width= "200DP"
android:layout_height= "30DP"
Android:layout_margin= "10DP"
android:orientation= "Vertical"
android:background= "@drawable/border_s"
>
</LinearLayout>
Border_s.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<shape xmlns:android= "Http://schemas.android.com/apk/res/android" >
<!--fill Color-
<solid android:color= "@color/yellow"/>
<!--border width, color---
<stroke
Android:width= "0.1DP"
Android:color= "@color/black"/>
<!--radians of 4 angles set--
<corners
Android:topleftradius= "10.0dip"
Android:toprightradius= "10.0dip"
Android:bottomleftradius= "10.0dip"
Android:bottomrightradius= "10.0dip"
/>
</shape>
(3) Horizontal line, vertical line
<textview
Android:layout_width= "200DP"
android:layout_height= "0.5DP"
android:background= "@color/black"
/>
<textview
android:layout_margintop= "10DP"
Android:layout_width= "0.5DP"
android:layout_height= "50DP"
android:background= "@color/black"
/>
(4) button effect
<button
Android:id= "@+id/button2"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_margintop= "5DP"
android:background= "@drawable/btn_style_green"
android:text= "button"
Android:textcolor= "@color/white"
/>
Btn_style_green.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<selector xmlns:android= "Http://schemas.android.com/apk/res/android" >
<item android:drawable= "@drawable/button_green_bg" android:state_pressed= "true"/>
<item android:drawable= "@drawable/button_blue_bg" android:state_focused= "false" android:state_pressed= "false"/ >
</selector>
Button_green_bg.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<shape
Xmlns:android= "Http://schemas.android.com/apk/res/android" >
<solid android:color= "@color/green"/>
<stroke android:width= "0.5dip" android:color= "@color/black"/>
<corners android:topleftradius= "5.0dip" android:toprightradius= "5.0dip" android:bottomleftradius= "5.0dip" android:bottomrightradius= "5.0dip"/>
</shape>
Button_blue_bg.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<shape
Xmlns:android= "Http://schemas.android.com/apk/res/android" >
<solid android:color= "@color/blue"/>
<stroke android:width= "0.5dip" android:color= "@color/black"/>
<corners android:topleftradius= "5.0dip" android:toprightradius= "5.0dip" android:bottomleftradius= "5.0dip" android:bottomrightradius= "5.0dip"/>
</shape>
Normal Status: click:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Summary of XML layout content (iii)--android