From: http://hi.baidu.com/china_8/item/b1d7e41005111b7f7a5f25a2
Terms and concepts related to mobile phone resolution
Screen size: the actual physical size, diagonal measurement of the screen. For convenience, Android divides all the screen sizes into four broad sizes: small, normal, large, and extremely large.
Screen density: the number of pixels in the physical area of the screen, usually known as DPI (points per inch ). For convenience, Android divides all the actual screen density into: low, medium, high, and extremely high.
Direction: from the user's point of view, it is the screen direction, that is, the horizontal or vertical meaning.
Resolution: The total number of physical pixels on the screen. (Officially, applications should focus only on screen size and density)
Density-independent pixels: a virtual pixel unit (officially, you should use density-independent pixels to define the UI layout to express the layout size or position, by default, the system assumes that the "medium" density screen is the benchmark, and its screen density is equivalent to a DPI screen. During running, the system scales the DP unit according to the actual screen density. You can use the PX = DP * (DPI/160) method to convert the DP unit to screen pixels. On a 160dpi screen, 1dp = 1px. On a 240 DPI screen, 1 dp = 1.5px. When defining the layout, we should use the DP Unit to ensure that the user interface is properly displayed on the screen of different density)
About the supported screen range
Four broad dimensions are officially defined: small, normal, large, and larger. Four types of density: low, medium, high, and extremely high. Both the general size and density can span a series of dimensions and density (the official upload does not have sufficient permissions for one week )
Density independence
The official saying is that it is very important to ensure the independence of density. Without it, system controls in your application may display exceptions on screens with the same physical size and different density.
There are two independent Android system help density methods:
1. Use the DP unit.
2. Bitmap resource scaling can lead to blurred bitmaps of pixels. bitmaps of different resolutions can be provided based on the current screen density. Official tips: if a set of images are provided, at least a higher resolution and high density bitmap is provided, rather than a medium density design bitmap.
How to support multiple screens
The official statement ensures that the system has done a lot of work to adapt to multiple screens, but we also need to do some work to better handle different screen configurations:
1. display a list of screen sizes that declare that your application supports.
<Span style = "font-family: kaiti_gb2312; font-size: 16px;">
Android: resizeable = ["true" | "false"]
Android: smallscreens = ["true" | "false"]
Android: normalscreens = ["true" | "false"]
Android: largescreens = ["true" | "false"]
Android: xlargescreens = ["true" | "false"]
Android: anydensity = ["true" | "false"]/> </span>
2. provide different la s based on different screen sizes
By default, Android automatically adjusts the layout of the application. However, in most cases, different layout resources are added based on the general size, small size, normal size, and larger size. For example, to support a screen with a size of large, you need to create a folder named Layout-large/In the res directory and provide layout. Of course, you can also create the layout-port and layout-land directories under the res directory, which place two layout files, vertical screen and horizontal screen, respectively, to automatically switch the portrait screen.
3. provide different screen density and different bitmap drawables
By default, the system will automatically adjust and scale the bitmap, but it is inevitable to stretch the bitmap. To ensure that your bitmap is the best-looking, according to the broad senseDensity,Low, medium, high, and extra high add different bitmap resources. For example, to provide a suitable picture for a screen with a low density, you need to create a folder named drawable-ldpi /. Try to use images in the format of. The image size is determined as follows: low: Medium: high: extra high ratio is 3: 4: 6: 8. For example, for a medium screen, if the pixel size of your image is 48 × 48, the low-density screen size should be 36 × 36, and the high) is 72 × 72, extra high is 96 × 96.
How can the system dynamically find alternative resources?
1. The system dynamically uses programs to provide specific resources based on the current screen size and density.
2. If no matching resource exists, the system scales the resource with the default resource to match the resource on the current screen. The "default" resource is the resource with no tag configuration qualifier.
(This is just a simple statement. For details, refer to the next chapter on finding alternative resources)
Directory for system resource configuration(I only list some general items. Some resource configuration directories are available in the default project)
The Android system supports multiple configuration resource files. We can append a new resource directory to your android project. Naming rules: Resource Name-delimiter
Note: If the landscape or portrait screen is not specified, both the layout and the bitmap above are applicable to the landscape and landscape screens. If you want to specify a horizontal screen, such as drawable-land-hdpi portrait screen drawable-Port-hdpi, the key is drawable-xlarge and layout-xlarge, the requirements for API level are above 9, which means that the tablet or mobile phone of your Android system does not match Layout-xlarge at all. Because the API level is 8. Drawable-tvadpi requires more than 13 API levels.
In fact, the preceding Layout-large directory is actually a range. When the system determines the directory that the program should match based on the size and density of the current screen. You can also individually customize some layout-l024x600 that does not comply with Google standards (the middle of the match is an English letter X), of which 1024 and 600 are in DP. You can determine the file that your device needs to define based on the resolution and density of your device.
However, we recommend that you use dimensions to indicate resource Layout-large. The resolution Layout-1024*600 is not recommended.
We recommend that you read more documents. Official Instructions:
Xlarge screens are at least 960dp x 720dp
Large screens are at least 640dp x 480dp
Normal screens are at least 470dp x 320dp
Small screens are at least between DP x 320dp
The above defines a range for resource adaptation in a broad-sized layout. you can know that the system will match the layout of the file based on your device.
If there is a popular mediapad sold by Huawei, we know that the resolution is 1280*800, and the density is 7 inches.
The density is 215.69 according to the check and resolution. Then, according to dp = px/(DPI/160), a range of 593.471 can be obtained. Therefore, the device system will match the resource layout file Layout-large.