Android:layout_weight attribute parsing

Source: Internet
Author: User

1. There are multiple textview in one linearlayout, and one textview is multiple rows. They align first line (aligned according to the parent method baseline),

Set baselinealigned = "false" in LinearLayout to align the control.

2. When using layout_weight in transverse linearlayout, the general setting Layout_width = "0DP", if the width of "111111111111" is assigned first, then the remaining width is pressed 1 : 2:3 were allocated to three textview.

3. Assuming that the screen width is 480p, then when three textview widths are not match_parent. Assign the size of the control declaration first, and then assign the remaining press weight. (The result can be negative)

4. When there is only one textview, we want it to occupy half the screen width, you can set weightsum= "2", such as

5. Properties in the control that begin with android:layout_ are represented by the parent class container. For example, layout_gravity represents the alignment of the control relative to the parent class container, and gravity represents the alignment of its own content.

Android:layout_weight attribute parsing

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.