Excerpt from: http://blog.csdn.net/sjf0115/article/details/7213565/
Tablelayout is a complex layout, the simplest use is simply to drag the control to make an interface, but in fact, often in the code to use the Tablelayout, for example, to make a table effect. This article mainly introduces the basic use method of Tablelayout.
[Java]View PlainCopy
- <?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"-------> to fill the specified column with a blank part in the No. 0 action order
Set stretchcolumns=0, the result is as follows, the No. 0 column is populated as far as possible
Set Stretchcolumns=1, the result is as follows, the 1th column is populated as far as possible
2 android:shrinkcolumns = "specified column": Automatically extends the specified column to fill the available parts with the No. 0 action order
Shrinkcolumns does not work when the controls inside the Layoutrow are not covered by the layout, such as
When the controls inside the Layoutrow are not covered by the layout (rewrite the contents of the third button)
3 Android:collapsecolumns = "specified column" No. 0 behavior, hides the specified column
Android:collapsecolumns when this property is empty, such as:
android:collapsecolumns= "0" means to remove the No. 0 column, such as:
Android Learning notes Android:collapsecolumns, Android:shrinkcolumns and Stretchcolumns