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: