Android device screen size is a variety of, such as millet is 4 inches, the Xoom tablet is 10 inches, the resolution is also strange, 800x480,960x540, etc., Android version of the fragmentation of the problem is lingering in the heart, However, in the design of the application can be divided into two chunks: 3.0 before the version and the version after 3.0. What's the problem with this situation? Let's illustrate with three assumptions.
1. If you have two 4-inch devices on your hand, device A has a resolution of 800x480 and device B has a resolution of 1600x960. You've designed a 64x64 pixel icon on device A to feel it's the right size, but when you put it on device B, the icon looks like it's half the size of the previous one. 2. Assuming that you have two devices on your hands, device A is 4 inches and device B is 10 inches. A tab control is placed above device A, with three tabs. When you put it on device B, the tab control's three tabs are pulled very long, and the space that originally placed 6 pages is only three pages signed. 3. Assuming that you have two devices, device A is Android2.3, device B is Android4.0, and device B does not have a menu, style is not the same. You find it inappropriate to use the same style of skin on two devices.
Google offers a set of systems to address these issues. We go back to the picture above, drawable folder has ldpi, MDPI, hdpi, xhdpi four kinds. DPI refers to pixels per inch, while ldpi refers to 120,mdpi refers to 160,hdpi refers to 240,xhdpi 320. Xiaomi mobile phone is 4 inches, 854x480 resolution, then the Xiaomi phone dpi is 854 square plus 480 squared and open 2 square after divided by 4, the result is about 245. If the app is installed on a Xiaomi phone, then the system calls the resources in the drawable-hdpi in the diagram. In this way, you only need to do 4 sets of resources in drawable-ldpi, drawable-mdpi, drawable-hdpi and drawable-xdpi (the icon can be produced according to the proportion of 3:4:6:8 image resources), Then we can solve the problem mentioned in the above hypothesis 1.
For devices with the same DPI, but not the same size, you can control the layout of various resources through a layout file. Google divides the device into small (two to three inches), normal (4 inches or so), large (5~7 inches), and XLarge (more than 7 inches). In the above hypothesis 2, we can configure the tab bar of 3 tabs in Layout-normal, and configure the tab bar of 6 tabs in Layout-xlarge. If your app has the same layout on all devices, you don't have to consider layouts for different sizes. Those layout* folders can be seen, the application on the HDPI and XHDPI support the screen, and the layout of the screen is inconsistent, but does not consider the different sizes of devices using different layouts.
Android3.0 before the style and Android3.0 (including 3.0) after the style of the difference is very large, the image of the application used in two styles of resources and layout. Android2.3 Millet will use the files in drawable-hdpi and layout-hdpi, and Android4.0 millet will use the files in Drawable-hdpi-v11 and layout-hdpi-v11.
Android various screen adaptation principles