What's the difference between fill_parent, Match_parent and Wrap_content in Android?

Source: Internet
Author: User

Three properties are used to fit the horizontal or vertical size of the view, and a layout based on the contents or dimensions of the view is more convenient than specifying the view range precisely.

1) fill_parent

Setting the layout of a component to fill_parent will force the component to expand to fill as much space as possible within the layout unit. For example: Setting a top layout or a control for fill_parent will force it to fill the entire screen.

2) match_parent
Android2.2 "API 8" in Match_parent and fill_parent is a meaning. Two parameters meaning, match_parent more appropriate, so from the beginning of Android2.2 two words can be used.

If you consider the use of a lower version, you need to use "fill_parent" .

3) Wrap_content

  Setting the size of a view to Wrap_content will force the view to expand to show the entire content. As an example of TextView and ImageView controls, when set to Wrap_content, the text and images inside them will be fully displayed, and the layout elements will change size based on the content.

What's the difference between fill_parent, Match_parent and Wrap_content in Android?

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.