Set the border for the view control, which can be set dynamically up or down. Through the layout file.
1. Create a new Shape_main_list_bg.xml file under the Drawable folder
- <layer-list xmlns:android= "Http://schemas.android.com/apk/res/android" >
- <!--This is the main color--
- <item>
- <shape>
- <!--border Color-
- <solid android:color= "#00FF00"/>
- </shape>
- </item>
- <!--set the 8DP border to the left and right of the view--
- <item android:top= "8DP" android:left= "8DP" android:right= "8DP" >
- <shape>
- <!--view Fill Color-
- <solid android:color= "#FFFFFF"/>
- </shape>
- </item>
- </layer-list>
2. Setting a background for a control
- <edittext
- Android:padding= "20DP"
- Android:layout_margin= "15DP"
- Android:layout_width= "Match_parent"
- android:layout_height= "Wrap_content"
- Android:hint= "Please enter EditText content"
- android:background= "@drawable/shape_main_list_bg"/>
3. as follows:
Recommended to create their own Android QQ group: 202928390 welcome everyone to join.
Android gives view settings up and down borders