Android development study notes (6) RelativeLayout RelativeLayout

Case effect:
Insert picture description here

Source code:

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

Insert picture description here
Insert picture description here
Two values ​​true aligned, false not aligned
relative to a control layout_toLeftOfs (not written in the example)

Summary: The relative layout is relatively simple, the main attention is to take an id name for each control

Guess you like

Origin blog.csdn.net/qq1198768105/article/details/113824164