Personal experience-the Layout_height property of the Android Relativelayout layout is set to wrap_content when the pit

Source: Internet
Author: User

The Layout_height property of the Android Relativelayout layout is set to Wrap_content when the pit:

Conditions for this pit to appear:

The Layout_height property of the 1.RelativeLayout layout is set to Wrap_content

2. A "Center View" is set to Layout_centerx (Layout_centervertical, Layout_centerhorizontal, layout_centerinparent)

3. Other view layout relative to "Center view"

At this time the pit appeared:

No matter what other view settings are under "Center View" (Layout_below, Layout_below), above (layout_above), bottom alignment (layout_alignbottom) and so on, all is not valid!

Pits Solution:

The Layout_height property of the Relativelayout layout is set to Match_parent!

Even if the outer layer has linearlayout use layout_weight to divide the space, its match_parent will not support the outer linearlayout space.

Originally want to set wrap_content, in fact, is afraid of the internal relativelayout set match_parent will be big only, practice proves, worry about!

Personal experience-the Layout_height property of the Android Relativelayout layout is set to wrap_content when the pit

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.