The common layout of Android, the upper left corner, the upper right corner and the lower row.
Effect:
Code (there may be redundant and insufficient):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/f1_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/f2_container"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:gravity = "left">
<Button
android:id="@+id/button_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:id="@+id/button_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮2"
android:layout_below="@+id/button_1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/f3_container"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="按钮3"
android:layout_gravity= "top|right"
android:layout_alignParentRight="true"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/f4_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity = "center|bottom"
xmlns:android="http://schemas.android.com/apk/res/android">
<Button
android:id="@+id/button_M"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:text="功能1"
android:layout_weight="1"/>
<Button
android:id="@+id/button_S"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:text="功能2"
android:layout_weight="1"/>
<Button
android:id="@+id/button_G"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:text="功能3"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>
The reason why the “cannot resolve symbol'R'” that made me bald for an hour is that android:orientation=“horizontal” in the RelativeLayout was written as vertical at the beginning, and there should always be error messages under the xml but I didn’t pay attention. So the newly created files are all red, it's really a shame/funny face. I don't know why it's not vertical/funny face