Android Component Width Height adaptive

Source: Internet
Author: User

For Android components to use the flexibility of layouts and to accommodate screens of various sizes, you should use Wrap_content and match_parent to control the width and height of some view components.

With Wrap_content, the width and height of the view are set to the minimum size required to fit the content in the view, and match_parent (referred to as fill_parent at levels below API Level 8) expands the component to match the dimensions of its parent view.


If you use Wrap_content and match_parent dimension values instead of hard-coded dimensions, the view will use only the space or expansion that you want to fill the available space accordingly. This method allows the layout to properly accommodate various screen sizes and screen orientations.


How to calculate control weight in Android:

Android:layout_weight: If view sets this property and is valid, the view width is equal to the original width (android:layout_width) plus the remaining space.


This article is from the "Small Ant" blog, please make sure to keep this source http://16410743.blog.51cto.com/10657793/1691317

Android Component Width Height adaptive

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.