對於Margins中的設置,當Top爲10px時,說明此控件頂部空餘10px,當爲Left時,此控件左側空出10px。android
<?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="wrap_content"
android:padding="10px" >xml
<TextView
android:id="@+id/txt01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FF0000"
android:text="Type here:" />utf-8
<EditText
android:id="@+id/edit1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txt01"
android:layout_marginTop="10px" />get
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/edit1"
android:layout_marginLeft="10px"
android:background="#0000FF"
android:text="OK" />it
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/edit1"
android:layout_toLeftOf="@id/btn1"
android:background="#0000FF"
android:text="Cancle" />io
</RelativeLayout>coding