Android: collapsecolumns, Android: shrinkcolumns and stretchcolumns

Source: Internet
Author: User

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:

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.