Android tablelayout Table layout

Source: Internet
Author: User

1. Related attributes

1.1, Common Properties android:collapsecolumns set the sequence number of the  column that needs to be hidden    Android:shrinkcolumns set the serial number    of the column that is allowed to be shrunk Android:stretchcolumns set the serial number of the column that is being stretched    Note: The column number is calculated from 0, set multiple "1,3", all columns take effect "*"    = "2" means skip the second     = "4" means merging 4 cells 1.2, how to determine the number of rows and columns    ! How to add components directly to Tablelayout, that component will fill up the line    ! How to think of multiple components in a row, add a TableRow container and put the components in    ! The number of components in the TableRow determines the column count, and the width of the column is determined by the widest cell    ! TableRow width is the default cannot be modified, height can be customized    ! The width of the entire table layout depends on the width of the parent container

2. Example

<?XML version= "1.0" encoding= "Utf-8"?><Tablelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Tools:context=". Loginactivity "Android:stretchcolumns= "0,3"android:gravity= "Center_vertical"Android:background= "#66ff66">    <TableRow>        <TextView/>        <TextViewAndroid:layout_height= "Wrap_content"Android:text= "User name:"/>        <EditTextAndroid:layout_height= "Wrap_content"            />        <TextView/>    </TableRow>    <TableRow>        <TextView/>        <TextViewAndroid:layout_height= "Wrap_content"Android:text= "Password"/>        <EditTextAndroid:layout_height= "Wrap_content"Android:minwidth= "200DP"/>        <TextView/>    </TableRow>    <TableRow>        <TextView/>        <ButtonAndroid:layout_height= "Wrap_content"Android:text= "Login"/>        <ButtonAndroid:layout_width= "60DP"Android:text= "Exit"/>        <TextView/>    </TableRow></Tablelayout>

Android tablelayout Table layout

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.