XMLL
XMLL
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="BUTTON2"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="end">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON3"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON4" />
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="BUTTON5" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="start">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON6" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BUTTON7" />
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="BUTTON8" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="BUTTON9"
android:layout_weight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="BUTTON10"
android:layout_weight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="BUTTON11"
android:layout_weight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="BUTTON12"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" tools:context=".MainActivity2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="MissingConstraints"
android:layout_marginTop="15dp">
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_alignParentTop="true"
android:id="@+id/btn1"
android:text="Button1"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button2"
android:layout_alignParentEnd="true"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button3"
android:id="@+id/btn3"
android:layout_below="@id/btn1"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button4"
android:layout_centerInParent="true"
android:layout_below="@id/btn1"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button5"
android:layout_alignParentEnd="true"
android:layout_below="@id/btn1"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button6"
android:layout_alignParentLeft="true"
android:layout_below="@id/btn3"
android:id="@+id/btn6"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button7"
android:layout_alignParentRight="true"
android:layout_below="@id/btn6"
android:id="@+id/btn7"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button8"
android:layout_alignParentLeft="true"
android:layout_below="@id/btn7"
android:id="@+id/btn8"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button9"
android:layout_alignParentRight="true"
android:layout_below="@id/btn7"
android:id="@+id/btn9"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button10"
android:layout_alignParentLeft="true"
android:layout_below="@id/btn8"
android:id="@+id/btn10"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button11"
android:layout_centerInParent="true"
android:layout_below="@id/btn8"
android:id="@+id/btn11"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button12"
android:layout_centerInParent="true"
android:layout_below="@id/btn10"
android:id="@+id/btn12"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button13"
android:layout_alignParentLeft="true"
android:layout_below="@id/btn12"
android:id="@+id/btn13"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button14"
android:layout_centerInParent="true"
android:layout_below="@id/btn13"
android:id="@+id/btn14"/>
<Button
android:layout_marginTop="15dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button15"
android:layout_alignParentRight="true"
android:layout_below="@id/btn14"
android:id="@+id/btn15"/>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>