Tablelayout is a complex layout. The simplest method is to drag the control to make an interface. However, tablelayout is often used in the Code, for example, to make a table. This topic describes how to use tablelayout.
<?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TableRow> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button1" android:layout_column="0"/> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello, I am a Button2" android:layout_column="1"/> </TableRow> </TableLayout>
1 Android: stretchcolumns = "specified column" -------> In The 0th action order, try to fill the specified column with the blank part
If stretchcolumns is set to 0, the result is as follows: 0th columns should be filled as much as possible.
If stretchcolumns is set to 1, the result is as follows: 1st columns should be filled as much as possible.
2 Android: shrinkcolumns = "specified column": automatically extends the specified column to fill the available part in The 0th action order.
Shrinkcolumns does not work when the controls in layoutrow are not full of layoutrow layout, as shown in figure
When the controls in layoutrow are not full (rewrite the content of the third button)
3 Android: collapsecolumns = "specified column" 0th behavior order, hiding the specified Column
Android: collapsecolumns when this attribute is null, for example:
Android: collapsecolumns = "0" means to remove the 0th columns, for example: