<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"></LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"></LinearLayout>
</LinearLayout>
</LinearLayout>
I just created this screen configuration. If you write it like this, it splits into the X and Y axes and comes out with four sections How can I write this in grid layout or table layout?
I think I've tried various methods, but I don't know if there's no weight attribute, so it's going to go off the screen
android layout
I think you make everything you want with grid or table I think you can use linearlayout for only 4 parts and use table or grid for the contents.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TableRow>
<TextView android:text="Name" />
<TextView android:text="Name" />
</TableRow>
</TableLayout>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TableRow>
<TextView android:text="Name" />
<TextView android:text="Name" />
<TextView android:text="Name" />
</TableRow>
<TableRow>
<TextView android:text="Name" />
<TextView android:text="Name" />
<TextView android:text="Name" />
</TableRow>
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TableRow>
<TextView android:text="Name" />
<TextView android:text="Name" />
</TableRow>
</TableLayout>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<TableRow>
<TextView android:text="Name" />
<TextView android:text="Name" />
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
© 2024 OneMinuteCode. All rights reserved.