Android screen Adaptation

Source: Internet
Author: User

Reference: http://blog.csdn.net/zhaokaiqiang1992/article/details/45419023

The following principles are supported for various screen sizes:

Use Wrap_content,match_parent,weight (try to avoid the size of the control to die, such as 40DP)

Use relative layout to disable Absolute layout additions: (linear layout for situations with a proportional relationship, use with weigh)

Using qualifiers

Using auto-stretch bitmaps


Weight:

Calculated width = width of original width + percentage of remaining space

For example L: Screen width l


button1:2/3l = L + (l-2l) *1/3

button2:1/3l = L + (l-2l) *2/3



button1:1/3l = 0+ 1/3l

BUTTON2:2/3 = 0 + 2/3l


Use minimum width qualifier: android3.0 after support LAYOUT-SW600DP (sw:small width)

Do not differentiate whether the horizontal screen: As long as the width is greater than 600DP will default to load the corresponding layout of the folder


Normal Mobile: Layout/main.xml

Tablet: layout-sw600dp/main.xml (Create a new folder with the layout level under res named Layout-large a layout file with the same name under the folder is selected to load the layout file under different folders depending on the size of the hardware)

Screen Orientation qualifier:

Layout-land

Layout-port


.9 Figure

The point on the left and top points is the stretched point

Left point: Stretches the point horizontally across the area (the horizontal line where the point is) when stretched up and down

Top point: Stretches the point vertically across the area (the vertical bar where the point is) when stretched left and right


The area selected on the right and bottom can be modified padding

1. Icon:






2. Fonts

Settings must be even, odd numbers can cause pixel loss when zooming in:






Android screen Adaptation

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.