Strictly speaking, as a reader, you should read this article from a critical perspective, this article is based on my reading and practice of the official Android development document Supporting Multiple Screens and the formation of communication with developers. It is a summary of my personal understanding of the current basin.
I. Multiple screens supported by Android
Traditionally, this is generally the case:
Ldpi: resolution 240x320
Mdpi: resolution 320 × 480
Hdpi: resolution 480x800 or 480X854
But in fact it is not that simple. You can see that ldpi is actually from 480x800, or even 1024x600.
| |
Low Density (ldpi 120) |
Medium Density (mdpi 160) |
High density (hd pi 240) |
Ultra-high density (320 xhdpi) |
| Small Screen |
QVGA (240x320) |
|
480 × 640 |
|
| Medium Screen |
WQVGA400 (240x400)
WQVGA432 (240x432) |
HVGA (320x480) |
WVGA800 (480x800)
WVGA854 (480X854)
600 × 1024 |
640 × 960 |
| Large Screen |
WVGA800 ** (480x800)
WVGA854 ** (480X854) |
WVGA800 * (480x800)
WVGA854 * (480X854)
600 × 1024 |
|
|
| Large Screen |
1024 × 600 |
Wxga (1280x800)
1024 × 768
1280 × 768 |
1536 × 1152
1920 × 1152
1920 × 1200 |
2048 × 1536
2560 × 1536
2560 × 1600 |
2. How can we identify ldpi, mdpi, and hdpi?
Why ldpi, mdpi, and hdpi resolution? In my understanding, it is to achieve the best display effect under different screen density.
From the above, the resolution is not very reliable. How can it be reliable? In fact, as long as we know the screen resolution, screen size (diagonal line length), we can calculate the corresponding screen density, and then according to its range to obtain the screen density.
Dpi can be calculated based on the length or width. The formula is as follows:
Dpi = width/(size ^ 2 * width ^ 2)/(width ^ 2 + height ^ 2) ^ (1/2)
= Length/(size ^ 2 * length ^ 2)/(width ^ 2 + height ^ 2) ^ (1/2)
This formula can be calculated in excel.
The approximate calculation method is as follows:
1. For example, if the resolution is 320 × 480, the aspect ratio is. 5.
2. for example, if the screen size is 3.6, "length ^ 2 + width ^ 2 = 3.6 ^ 2 ″, that is, "width ^ 2 + 2.25 * width ^ 2 = 12.96", and the "width ^ 2 = 12.96/3.25" is obtained, then "width = (12.96/3.25) ^ (1/2) = 1.9969 ″
3. The width is 320px and is distributed on 1.9969 ", so the density is 320/1. 9969 = 160.2467.
4. Therefore, this density is the mdpi density.
Note:
1. This part of reference is: http://blog.sina.com.cn/s/blog_7377a8a20100qydh.html
2. Two DPI computing applications
Https://market.android.com/details? Id = appinventor. ai_wenjiun1024.dpicalculato
Https://market.android.com/details? Id = com. Andy. DPI
Iii. Rough resolution ldpi, mdpi, and hdpi
In the traditional sense, it is quite reliable to use the old materials to determine the DPI of mobile phones by resolution:
Ldpi: resolution 240x320
Mdpi: resolution 320 × 480
Hdpi: resolution 480x800 or 480X854
Why? If ldpi is 320x480, a 4.8-inch screen is required. If ldpi is 480x800, A 7.8-inch screen is required. If mdpi is 480x800, A 5.2-inch screen is required. Generally, the screen on a mobile phone is not so big, so it is still reliable.
Of course, if you want to identify the DPI of the android pad, we suggest you calculate it.
4. How to Adapt to patch 9?
Official: http://developer.android.com/guide/developing/tools/draw9patch.html
To put it simply, if your image resources can be stretched without deformation or blurring, you can use the 9-patch format, instead of providing different image resources for different DPI.
This format is often used in background image resources.
The android SDK provides a 9-patch production tool. The dashes above indicate the areas that can be stretched horizontally, the left dashes indicate the areas that can be stretched vertically, and the dashes below indicate the areas in the center horizontally, the dashes on the right indicate the vertical center area.
In basin understanding, hdpi images are generally provided and made in the 9-patch format. At this time, the stretching will not cause problems in mdpi and ldpi.
This part of the Internet has a lot of information, and I will not go into details here. The above description is for the convenience of remembering and understanding the basin in the future.
5. How to Adapt to the specified icon and other images
In addition to indicating that the image is not deformed in the stretch area, similar icons or other image resources that will be deformed, it is best to provide different images for different DPI.
Note that, if xhdpi is not supported, hdpi, mdpi, and ldpi are supported, you must consider the corresponding proportion, that is, 1.5: 1: 0.75, you need to maintain the integer pixel value under the corresponding proportional relationship, otherwise it may be blurred.
For example, if the size of an icon in hdpi is 48 × 48, the mdpi and ldpi are 32 × 32 and 24 × 24, respectively, if this icon is set to 50 × 50 in hdpi, 50 under mdpi cannot be divided into 1.5, therefore, the mdpi mark will be blurred no matter whether the icon is set to 33 × 33 or 34 × 34 (it may be specified independently to avoid this situation, which is not well understood in this section ).
Vi. menu icons and application icons
This section is fully described in official documents, but many application developers do not follow the specifications. For example, although the desktop icon resolution on hdpi is defined as 72 × 72, but in fact it should only occupy 60 × 60 (if it is a square, it should be 56 × 56), and many applications directly set the icon to 72 × 72, therefore, many icons in Android are larger than those in the system.
For this part, please refer to the official document. The practice is to make three copies, but you only need to follow the document.
Http://developer.android.com/guide/practices/ui_guidelines/icon_design.html
VII. Summary
As product personnel, the purpose of understanding this is to coordinate the corresponding UI resources with the UI personnel, and maintain smooth communication with the development personnel. If you do not know this, it may be more than half the effort, as product personnel, let's take a look.
Please do not hesitate to inform us of the error in the above description.
(End)