Effect:
Source code:
<TableLayout android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content"
android:shrinkColumns="1,2"
android:stretchColumns="1">
<Button
android:text="按钮1"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
</Button>
<TableRow>
<Button
android:text="按钮1"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
</Button>
<Button
android:text="按钮2"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
</Button>
<Button
android:text="按钮3"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
</Button>
</TableRow>
</TableLayout>
通过 < T a b l e R o w > <TableRow> <T a b l e R o w> To fill row by row
android:shrinkColumns="1,2" means that the content of the first and second grids of the row will be compressed when it is not displayed (the grid label starts from 0)
android:stretchColumns="1"> means that there is surplus Space will expand the first respective content