Android Learning notes Android:collapsecolumns, Android:shrinkcolumns and Stretchcolumns

Source: Internet
Author: User

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
  1. <?xml version="1.0" encoding="Utf-8"?>
  2. <tablelayout xmlns:android="Http://schemas.android.com/apk/res/android"
  3. Android:layout_width="Fill_parent"
  4. android:layout_height="Fill_parent"
  5. >
  6. <TableRow>
  7. <button
  8. android:id="@+id/button1"
  9. Android:layout_width="Wrap_content"
  10. android:layout_height="Wrap_content"
  11. android:text="Button1"
  12. android:layout_column="0"/>
  13. <button
  14. android:id="@+id/button2"
  15. Android:layout_width="Wrap_content"
  16. android:layout_height="Wrap_content"
  17. android:text="Hello, I am a Button2"
  18. android:layout_column="1"/>
  19. </TableRow>
  20. </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

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.