One, what is the relative layout
A relative layout is another way in which controls are placed
A relative layout is a relative position by specifying the relative position between the current control and the sibling or parent control.
Second, why use relative layout
good performance relative to linear layout UI
Two common sets of properties for relative layout
value is one of the existing control IDs:
(1) Android:layout_below placed at the bottom edge of an existing ID control (that is, the top of the current control is aligned to the bottom edge of an ID control)
(2) Android:layout_above is placed on the top edge of an existing ID control (that is, the bottom edge of the current control is aligned to the top edge of an ID control)
(3) Android:layout_toleftof placed on the left side of an existing ID control (that is, to the right of the current control to the left of an ID control)
(4) Android:layout_torightof is placed on the right side of an existing ID control (that is, the left of the current control is aligned to the right of an ID control)
(5) Android:layout_alignleft the left edge of the current control to the left edge of an existing ID control
(6) Android:layout_alignrigth the right edge of the current control to the right edge of an existing ID control
(7) Android:layout_aligntop the top edge of the current control to the top edge of an existing ID control
(8) Android:alignbottom the bottom edge of the current control to the bottom edge of an existing ID control
1. The baseline for the Zitze control
a line that is defined in order to ensure the orderly printing of letters.
Value is the ID of one of the existing controls:
Android:layout_alignbaseline
2. Align with four edges of the parent control
The value is True or false:
(1) Android:layout_aliginparentleft to the left of the parent control
(2) Android:layout_alignparentright the money to the right of the parent control
(3) Android:layout_alignparenttop to the top of the parent control
(4) Android:layout_alignparentbottom to the bottom of the parent control
3. The central location of the Zitze parent control
The value is True or false:
(1) Android:layout_centerinparent to the most central position of the parent control
(2) Android:layout_layout_horizontal alignment to the center of the parent control's horizontal direction
(3) Android:layout_centervertical alignment to the center of the parent control's vertical direction
4.android 4.2 New properties for relativelayout layout
value is the di of one of the existing controls:
(1) Android:layout_alignstart The starting position of the current control to the starting position of an existing control ID
(2) Android:layout_alignend the current control's starting position to the alignment to an existing control ID to the end position
The value is True or false:
(1) Android:layout_alignparentstart to the starting position of the parent control
(2) Android:layout_alignparentend alignment to the end of the parent control
5. Font Center
android:gravity= "Center"
Default value:
Android:hint= "Value"
Andriod:inputtype= "Textpassworld"
Iv. relative layout Instance-login interface
<relativelayout 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 "Android:layou" T_margin= "20DP" tools:context= ". Mainactivity "> <textview android:id=" @+id/txttitle "android:layout_width=" Wrap_content "Andr"
oid:layout_height= "Wrap_content" android:layout_alignparentleft= "true" android:gravity= "Center_horizontal"
Android:layout_alignparentright= "true" android:text= "Login Interface"/> <edittext android:id= "@+id/username" Android:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:layout_alignleft= "@id/txttitl E "android:layout_alignright=" @id/txttitle "android:layout_below=" @id/txttitle "android:layout_margintop=" 20DP "android:hint=" username "/> <edittext android:id=" @+id/password "android:layout_width=" Wrap_c Ontent "
android:layout_height= "Wrap_content" android:layout_below= "@id/username" android:layout_alignleft= "@id/user
Name "android:layout_alignright=" @id/username "android:layout_margintop=" 20DP "android:hint=" password "
Android:inputtype= "Textcapwords"/> </RelativeLayout>