Android Multi-screen fitting

Source: Internet
Author: User

Problem:

Test, found that the application on different monitors display different effects (part of the text can not be fully displayed), naturally think of the problem of screen adaptation.

Follow the idea to organize as follows:

(i) Several concepts

1, the size of screen size, that is, the diagonal length (in inch-inches)

2, screen density density, that is, unit length pixel points (pots/inches)

3, resolution resolution, that is, the total number of pixels on the screen (width * height)

4, Density-independent Pixel (DP) independent pixel density. The standard is 160dip. That is, 1DP corresponds to 1 pixel, the calculation formula such as: PX = DP * (dpi/160), the larger the screen density, 1dp corresponding pixel points more.

(ii) Screen classification (size & density)

1, the total number of pixels, the size of the text to be changed, as shown in the following figure

Each classification has its minimum resolution, such as the following, can be divided according to the resolution type:

2, to screen density points, provide different pictures as shown in the following figure

Note1: The match is based on two of the above references.

Note2: There are also specifically for the level (landscape) and Vertical (portrait) Two kinds, the use of less, this does not repeat.

(iii) Android search for the best resource principles

1, excluding resources that are not compatible with the device settings

2, according to the qualifier (qualifier) priority, in order to find

3, under the qualifier, is there a resource path

4, exclude the resource path that is not included in the qualifier

5, continue to perform different qualifier lookups until you find the appropriate resource

As shown in the following illustration:

(iv) Project steps:

1, configuration in Manufest

    

Android:anydensity= "true"

Android:largescreens= "true"

Android:normalscreens= "true"

Android:smallscreens= "true"

Android:xlargescreens= "true"/>

2, create a new corresponding resource folder

A, Layout

As shown in the following illustration:

B, drawable

As shown in the following illustration:

In Drawable, the MDPI is the standard (i.e. 160dpi). The proportions remain 3:4:5:6, as shown in the following illustration:

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