This example introduces the usage of android: stretchColumns. It specifies the serial numbers of columns that can be extended and separated by commas. Columns with the stretchable attribute can occupy redundant controls of the table (similar to weight in LinearLayout ).
<TableLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: stretchColumns = "1">
<TableRow>
<TextView
Android: text = "@ string/table_layout_4_open"
Android: padding = "3dip"/>
<TextView
Android: text = "@ string/table_layout_4_open_shortcut"
Android: gravity = "right"
Android: padding = "3dip"/>
</TableRow>
<TableRow>
<TextView
Android: text = "@ string/table_layout_4_save"
Android: padding = "3dip"/>
<TextView
Android: text = "@ string/table_layout_4_save_shortcut"
Android: gravity = "right"
Android: padding = "3dip"/>
</TableRow>
</TableLayout>
In this example, the stretchable attribute is specified for Column 2nd, so the second column occupies the extra space of the table.