From: http://blog.csdn.net/moruite/article/details/6028547
1. terms and concepts
Terms |
Description |
Remarks |
Screen Size) |
It refers to the actual physical size of the mobile phone, such as commonly used 2.8 inch, 3.2 inch, 3.5 inch, 3.7 inch, diagonal |
Motorola's milestone mobile phone is 3.7 inch |
Aspect Ratio (width/height ratio) |
Refers to the actual physical size width/height ratio, divided into long and nolong |
Milestone is and belongs to long |
Resolution (resolution) |
Similar to the definition of computer resolution, it refers to the number of pixels in the portrait and horizontal directions of the mobile phone screen. |
Milestone is 854*480 |
DPI (DOT per inch) |
Number of pixels per inch, such as 120 DPI and 320 DPI. Assume that the physical size of the qvga (240*2 inch) resolution screen is (1.5 inch * 160), DPI = |
Can reflect the definition of the screen, used to scale the UI |
Density (density) |
The pixel value concentration in the screen. Resolution/screen size can reflect the cell phone density, |
|
Density-independent pixel (DIP) |
The Unit for calculating the logic density. The formula for the dip and the specific pixel value is dip/pixel = DPI/160, that is, PX = DP * (DPI/160) |
|
2. DPI Value Calculation
For example, calculate the WVGA (800*480) Resolution, 3.7 inch density DPI, as shown in 1
Figure 1
Diagonal pixel indicates the pixel value of the diagonal line (=), DPI = 933/3. 7 = 252
3. Mobile phone screen Classification
3.1 is divided into the following three categories based on the cell phone screen density (DPI) or screen size, as shown in figure 2.
Figure 2
3. 2 The relationship between mobile phone screen classification and pixel density is shown in Table 1:
|
Lowdensity (120), ldpi |
Medium Density (1, 160), mdpi |
High density (240), hdpi |
Small Screen |
Qvga (240x320) |
|
|
Normal Screen |
Wqvga400 (240x400) wqvga432 (240x432) |
Hvga (320x480) |
Wvga800 (480x800) wvga854 (480X854) |
Large Screen |
|
Wvga800 * (480x800) wvga854 * (480X854) |
|
Table 1
3.3 mobile phone size distribution (http://developer.android.com/resources/dashboard/screens.html) 3 shows, the current is mainly to the resolution of 800*480 and 854*480 mobile phone users mostly
Figure 3
From the above screen size distribution, we can only consider mobile phones with a density of 1 and 1.5 between 3-inches.
4. uidesign
From the perspective of development, the application provides three sets of UI layout files based on the screen of three types of Android phones, but three sets of corresponding interface icons are also required, as shown in table 2.
Icon type |
Standard asset sizes (in pixels), for Generalized screen Densities |
|
Low Density screen (ldpi) |
Medium Density screen (mdpi) |
High density screen (hdpi) |
Launcher |
36x36 PX |
48x48 PX |
72X72 PX |
Menu |
36x36 PX |
48x48 PX |
72X72 PX |
Status Bar |
24x24 PX |
32x32 px |
48x48 PX |
Tab |
24x24 PX |
32x32 px |
48x48 PX |
Dialog |
24x24 PX |
32x32 px |
48x48 PX |
List View |
24x24 PX |
32x32 px |
48x48 PX |
Table 2
5. How can I achieve adaptive screen size?
1) interface Layout
Five layout Layout, similar to the title bar of the WINDOS window), layout-small (layout with a screen size less than 3 inch), layout-normal (screen size less than 4.5 inch ), layout-large (between 4 inch and 7 inch), layout-xlarge (between 7 and 10 inch)
2) image resources
You need to prepare 5 sets of image resources, including drawable, drawalbe-ldpi, drawable-mdpi, drawable-hdpi, and drawable-xhdpi Based on the DPI value.
Android has an automatic matching mechanism to select the corresponding layout and image resources.