Android tablelayout Common Properties Introduction and demo

Source: Internet
Author: User

The properties that tablelayout often use are:

1.android:collapsecolumns: Hides the specified column in the No. 0 order: android:collapsecolumns=0,2 means to hide the No. 0 and 2nd columns
2.android:shrinkcolumns: In the No. 0 order, automatically extends the specified column to fill the available parts: when the layoutrow inside the control is not covered with layout, Shrinkcolumns does not work, set the shrinkcolumns= 0,1,2, the layout has not changed at all, because there is enough space left in the Layoutrow. When the layoutrow is filled with controls, shrinkcolumns=2 is set, and the control automatically fills the space vertically
3.android:stretchcolumns: With the No. 0 action order, try to fill the specified column with blank parts: Set Stretchcolumns=1, then the 1th column is filled as far as possible (BUTTON02 and TextView02 are filled to the right, Until TEXTVIEW03 is squeeze to the last side).

Tablelayout and Tablelayout is a set of collocation layout, Tablelayout Bottom, TableRow on the top of Tablelayout, and button, TextView and other controls on the TableRow, in addition, Controls can also be placed on top of tablelayout. 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.

The properties that tablelayout often use are:

Android:collapsecolumns: Hides the specified column in the No. 0 action order:

Android:collapsecolumns when this property is empty, such as:

The android:collapsecolumns=0,2--------------"means to remove the No. 0 and 2nd columns, such as:

Android:shrinkcolumns: In the No. 0 order, automatically extends the specified column to fill the available parts:

Shrinkcolumns does not work when the controls inside the Layoutrow are not covered by the layout, such as:

Set the shrinkcolumns=0,1,2, the layout has not changed completely, because there is still enough space in the Layoutrow.

When the layoutrow is covered with controls, such as:

Setting shrinkcolumns=2, the result is that the control automatically fills the space in the vertical direction:

Android:stretchcolumns: With the No. 0 action order, fill in the blanks with the specified columns as much as possible:

If you set Stretchcolumns=1, the result is that the 1th column is populated as far as possible (BUTTON02 and TextView02 are padded to the right until TextView03 is squeeze to the last edge).

Android Tablelayout + TableRow, though

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.