First, the goal.
Make a similar effect in your phone settings.
Second, the code implementation.
1, the overall use of linear layout, the top is a textview, the following a relative layout, and set the relative layout of the offset with the edge.
2. There are 4 components in the relative layout: 2 TextView, 1 checkboxes, and 1 straight lines.
3, the line of drawing: The <View.../> control, set the height of "0.1dip" (the size of the value determines the thickness of the line), the background color is black (background color is the color of the line), other properties such as width and other space as normal settings.
The code is as follows:
1<?xml version= "1.0" encoding= "Utf-8"?>2<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"3Android:layout_width= "Match_parent"4android:layout_height= "Match_parent"5android:orientation= "Vertical" >6 7<TextView8Android:layout_width= "Match_parent"9android:layout_height= "50dip"TenAndroid:background= "#00ffff" Oneandroid:gravity= "Center" Aandroid:text= "Setting Center" -Android:textcolor= "#000000" -Android:textsize= "26sp"/> the -<Relativelayout -Android:layout_width= "Wrap_content" -android:layout_height= "Wrap_content" +android:layout_marginleft= "10dip" -android:layout_marginright= "10dip" > + A<TextView atAndroid:id= "@+id/setting_update_title" -Android:layout_width= "Wrap_content" -android:layout_height= "Wrap_content" -android:layout_margintop= "10dip" -android:text= "Automatic Updates" -Android:textcolor= "#000000" inAndroid:textsize= "22dip"/> - to<TextView +Android:id= "@+id/setting_update_content" -Android:layout_width= "Wrap_content" theandroid:layout_height= "Wrap_content" *android:layout_below= "@id/setting_update_title" $Android:text= "Allow Automatic Updates when software is networked"Panax NotoginsengAndroid:textcolor= "#88000000" -Android:textsize= "18dip"/> the +<CheckBox AAndroid:id= "@+id/setting_update_checkbox" theAndroid:layout_width= "Wrap_content" +android:layout_height= "Wrap_content" -Android:layout_alignparentright= "true" $Android:layout_centervertical= "true"/> $<View -android:layout_below= "@id/setting_update_content" -Android:layout_width= "Match_parent" theandroid:layout_height= "0.1dip" -android:layout_margintop= "2dip"Wuyiandroid:background= "#70000000"/> the -</RelativeLayout> Wu -</LinearLayout>
View Code
Android instance-Mobile security Defender (vi)-Make ribbon (Set Center) UI interface