"@id/***""@id/***"trueandroid:layout_marginLeft = “10px”
<?xml version="1.0"encoding="Utf-8"?> <relativelayout xmlns:android="Http://schemas.android.com/apk/res/android"Android:layout_width="Fill_parent"android:layout_height="Fill_parent"> <textview android:id="@+id/label"Android:layout_width="Fill_parent"android:layout_height="Wrap_content"android:text="Type here:"/> <edittext android:id="@+id/entry"Android:layout_width="Fill_parent"android:layout_height="Wrap_content"Android:background="@android:d rawable/editbox_background"android:layout_below="@id/label"/> <button android:id="@+id/ok"Android:layout_width="Wrap_content"android:layout_height="Wrap_content"android:layout_below="@id/entry"android:layout_alignparentright="true"android:layout_marginleft="10dip"android:text="OK"/> <button android:layout_width="Wrap_content"android:layout_height="Wrap_content"android:layout_toleftof="@id/ok"android:layout_aligntop="@id/ok"android:text="Cancel"/> </RelativeLayout>
This is a very common layout content, explained as follows:
android:layout_below= "@id/label"/>
Places the current control below the control with the ID label.
Android:layout_alignparentright= "true"
Aligns the right end of the current control with the right end of the parent control. This property value can only be true or FALSE, which is false by default.
android:layout_marginleft= "10dip"
Leave the space on the left side of the current control empty.
android:layout_toleftof= "@id/ok"
Places the current control to the left of the control with an OK ID.
android:layout_aligntop= "@id/ok"
Aligns the current control with the upper end of the ID control. At this point, we have found that the properties of the various. Here's a quick summary:
- First Class: Property value is True or False
*android:layout_centerhrizontal
*android:layout_centervertical
*android:layout_centerinparent
*android:layout_alignparentbottom
*android:layout_alignparentleft
*android:layout_alignparentright
*android:layout_alignparenttop
*android:layout_alignwithparentifmissing
- Second class: The attribute value must be the reference name of the id "@id/id-name"
*android:layout_below
*android:layout_above
*android:layout_toleftof
*android:layout_torightof
*android:layout_aligntop
- Class III: Attribute values are specific pixel values, such as 30dip,40px
*android:layout_marginbottom
*android:layout_marginleft
*android:layout_marginright
*android:layout_margintop
Android Relativelayout Properties Encyclopedia (Chinese explanation)