RelativeLayout相关的布局属性

 对于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

相关文章
相关标签/搜索