Problem:
When testing, it was found that the application showed different effects on different displays (some text could not be fully displayed), and naturally thought about the screen fit problem.
Follow the idea to organize the following:
(i) Several concepts
1, the size of screen size , that is, the diagonal length (units inch-inches)
2, screen density density, that is, pixel points per unit length (pots/inches)
3, Resolution resolution, which is the total pixel count of 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.
(b) Screen classification (size & density)
1, the total number of pixels, the size of the text should be changed, as shown in
Each category has its minimum resolution, such as the following, which can be divided into categories according to resolution:
2, to screen density, provide different pictures as shown in
Note1: matches are referenced in both of the above.
Note2: There are also special for horizontal (landscape) and Vertical (portrait) Two, use less, here do not repeat.
(iii) Android search for the best resource principle
1. Exclude resources that are not compliant with device settings
2, according to the priority of the qualifier (qualifier), in order to find
3, under qualifier, whether there is a resource path
4. Exclude resource paths that are not included in the qualifier
5, continue to perform different qualifier lookups until the appropriate resource is found
As shown in the following:
(iv) Project steps:
1, configuration in Manufest
<supports-Screens android:anydensity="true" android: Largescreens="true" android:normalscreens=" True" android:smallscreens="true " Android:xlargescreens="true"
2, create the corresponding resource folder
A, Layout
For example, I now have three display resolutions:
1280*720,1024*768,1200*690 for each
According to the above minimum resolution requirements, divided into xlarge and large two categories, create a new two folders, as follows:
As shown in the following:
B, drawable
As shown in the following:
In Drawable, the MDPI is the standard (i.e. 160dpi). The proportions remain as 3:4:5:6 as shown in:
This article is from the "Little New column" blog, please be sure to keep this source http://mikewang.blog.51cto.com/3826268/865304
Android Multi-screen adaptation