天天看点

Android开发学习笔记(六)相对布局RelativeLayout

案例效果:

Android开发学习笔记(六)相对布局RelativeLayout

源码:

<RelativeLayout android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content"
    >

    <TextView
        android:id="@+id/labe1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="相对布局"
        android:textSize="50sp">

    </TextView>

    <EditText
        android:id="@+id/et1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/labe1">

    </EditText>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/et1"
        android:text="OK"
        android:layout_alignParentRight="true"
        android:layout_marginRight="10dp"></Button>
</RelativeLayout>      
Android开发学习笔记(六)相对布局RelativeLayout
Android开发学习笔记(六)相对布局RelativeLayout

两个值true对齐,false不对齐