To handle a wide range of resolutions and sizes.
For images, Android uses DPI as the unit. If you select an image, right-click the image under win and you will see the DPI attribute. The higher the DPI, the finer the image. For a mobile phone or display device, a pixel is a point, so DPI = PPI. In turn, it is often said that the height and height of the phone screen PPI are equivalent to the DPI value taken into account when writing a program.
The Retina screen of iPhone 4 is 326ppi, which belongs to the last xhdpi (about 320ppi) of ldpi mdpi hdpi xhdpi. Later, Android phones also had this value, which makes no sense to go up, however, you cannot see the principle of saving as much as possible. The pictures are processed by xhdpi, and the phones with low PPI are processed by their own systems.
Then there is the layout. The layout is normal for 4-inch and large for 4-inch to 7-inch (these are estimates ). Based on formula PX
= DP * (DPI/160)
And Principle
- Large screens are at least 640dp x 480dp
- Normal screens are at least 470dp x 320dp
In your calculation, the normal resolution is at least 2 * DPI, 4.65 inches, and the 630 P resolution of Galaxy Nexus is 315ppi. The width should be at least 720, while the P width is exactly the same.
After calculation, large is 3 * DPI in width, and Galaxy Nexus cannot meet the requirements. Most of the products that meet the requirements are 7-inch + tablets.
For mobile phones, if the aspect ratio is the same, you only need to write the normal layout.
In addition, as mentioned in the previous article, there are two types of resolutions: the mainstream and the mainstream.
There should be two cell phone la S, but it seems that there is no way (unless determined in the Code) to select a specific layout based on the aspect ratio.
.
New layout mechanisms introduced by Android 3 and 4, such as sw600dp, are used for tablets and are related to mobile phones.
The conclusion is:
Res/layout/my_layout.xml
Res/drawable-xhdpi/my_icon.png
And are processed with .9.png.
Google intended to make it easier to share code by running an APK on a mobile phone and tablet at the same time. However, I feel that the features of mobile phones and tablets of the same program will definitely be different, the possibility of a large screen is bigger than that of a small screen, and there are various interface la S and code. It Seems messy to put it in a project. It is not as good as a dedicated HD version for iOS tablet apps. This mixed strategy can easily cause the mobile phone version to be installed on the tablet, and then it will encounter an ugly deformation interface (I know it can be declared for a specific screen, but people may not necessarily set it, this involves screen compatibility mode), which has a bad experience.
Reference: http://developer.android.com/guide/practices/screens_support.html