Layout_weight formula calculation (to be continued) in Android is not completed

Source: Internet
Author: User

1. layout is an attribute in linearlayout, while tablelayout is a subclass of linearlayout. Therefore, layout_weight can be used in these two Laight S.

2. In reality, most developers do not want to change the layout ratio due to content changes. Therefore, set the view containing weight to layout_width = "fill_parent" (horizontal) or layout_height = "fill_parent" (vertical)

3. if you want to set the ratio of the Three Controls (unrestricted number of controls) to X: Y: Z, the following formula is used: X/(x + y + Z ), y/(x + y + Z), Z/(x + y + Z)
Then the denominator is subtracted from the numerator. The three controls should set the value of layout_weight to Z + Y, x + Z, and X + Y (which can be roughly divided)

The great gods who designed the Android system do not know what to consider.AlgorithmThis is the case

Related Article

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: 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.