Excerpt from: http://www.cnblogs.com/tinyphp/p/3812486.html
Tablelayout Inheritance LinearLayout
How many rows are there in a TableRow object?
Number of columns equal to TableRow of most child controls
Directly in the Tablelayout control, the control will occupy a row
Tablelayout property (also called global property): * Represents all Columns
Android:shrinkcolumns-------Set the columns that can be shrunk (the content is too much, then shrinks, expands to the second row, the control does not work when the tablelayout is not covered)
Android:stretchcolumns------Set extendable columns (filled with blanks)
Columns can have both Stretchcolumns and Shrinkcolumns properties
Android:collapsecolumns------Set the column to hide (index column starting from 0)
Internal Control Properties:
Android:layout_column-------The cell is displayed in the first few columns
Android:layout_span-------The cell occupies a number of columns, the default is 1
Stretch Shrink instance:
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutXmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:orientation= "Vertical"><!--Table 1-Stretching-<TablelayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "#ff0000"Android:shrinkcolumns= "0,1,2"><ButtonAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "I occupy one line"/><TableRow><ButtonAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "000000000000000000000000"></Button><ButtonAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "111111111111111111111111"></Button><ButtonAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "222222222222222222222222"></Button></TableRow><TableRow><ButtonAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "000000000000000000000000"></Button><ButtonAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_span= "2"Android:text= "I occupy 2 columns"></Button></TableRow></Tablelayout><!--Table 2-Shrinkage-<TablelayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "#FFCD6B"Android:stretchcolumns= "0,1"><TableRow><ButtonAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "Fill One"/><ButtonAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content" Android:text= "Fill Two" /> <button android: Layout_width= "wrap_content" android:layout_height< Span style= "COLOR: #0000ff" >= "wrap_content" Android:text = "normal three" /> </tablerow> </tablelayout></linearlayout>
Android: Control layout (table layout) tablelayout