Android multi-resolution support [latest version, including extra large screen]

Source: Internet
Author: User
If you have released a program for Android 1.5 or earlier, read this document carefully and consider how to make your old program have different resolutions, android 1.6 or the update platform is displayed normally. In most cases, you only need to make small changes to the program to achieve the goal, but you still need to test on platforms with various resolutions as much as possible.
Specifically, if you have a completed program and want it to run correctly on ultra-low resolution devices (such as 320x240, you need to read the "update policy of the old program" and the document will tell you how to do it.

Terms and concepts
Screen Size
The physical size of the screen, based on the diagonal length of the screen (such as 2.8, 3.5 ).
In short, Android simplifies all the screen sizes into four categories: super large, large, normal, and small. (Small, normal, large, and extra large .)
The program can provide three different layout schemes for these four screens, and then the system will be responsible for rendering your layout scheme to the corresponding screen in an appropriate way, this process does not require code intervention by programmers.


Screen Density

The total number of pixels on the physical screen. Similar to dimensions, there are also four types: low, medium, high, super high. (Low, medium, high, and extra high .) low-density screens have only a small number of pixels in the long and wide directions, while high-density screens usually have many-or even very many-pixels arranged in the same area. The screen density is very important. For example, the interface elements (such as a button) defined in pixels with the length and width are very large on low-density screens, but on a high-density screen, it will appear very small.

Screen Aspect Ratio
The ratio of the physical length of the screen to the physical width. The program can provide materials for the screen with a aspect ratio. You only need to use the resource categories provided by the system, long and notlong.

Resolution
Total number of pixels on the screen. Note that although the resolution is expressed as "width x length" in most cases, the resolution does not mean the aspect ratio of the screen. In Android systems, the program generally does not directly process the resolution.


Density-independent pixels (DIP)
A pixel in an abstract sense. A program uses it to define interface elements. As a unit unrelated to the actual density, it helps programmers build a layout scheme (width, height, and position of the interface element ).
A density-independent pixel is logically consistent with a pixel on a screen with a pixel density of DPI. This is also the default display device assumed by the Android platform. When running, the platform uses the density of the target screen as the benchmark to "transparently" all required dip scaling operations. To convert density-independent pixels to screen pixels, use the following simple formula: pixels = dips * (density/160 ). For example, on a screen with DPI 240, one dip equals 1.5 physical pixels. We strongly recommend that you use dip to define the interface layout of your program, because this ensures that your UI can be normally displayed on the screen of various resolutions.


Supported Screen Resolution Range
In Android 1.5 and earlier versions, it is assumed that the system will only run on a device with a resolution-hvga (320x480) Resolution. The size is 3.2. Since the system can only work on one screen, developers can write their own programs for that screen, without having to consider the display of programs on other screens.
However, since Android 1.6, the system has introduced support for screens of various sizes and resolutions to meet the running requirements of new platforms with various configurations. This means that when developers develop programs for Android 1.6 or later versions, they need to make additional designs for their programs to display on screens with multiple resolutions.
To simplify the programmer's troubles in various resolutions, and to enable platforms with various resolutions to run these programs directly, the Android platform classifies all screens by density and resolution, they are divided into four categories:
· Four major dimensions: super large, large, normal, and small;
· Four different density types: Ultra High, high (hdpi), medium (mdpi), and low (ldpi ).
If needed, the program can provide different resources (mainly layout) for screens of various sizes, or provide different resources (mainly Bitmap) for screens of various density ). In addition, the program does not need to deal with the size or density of the screen. During execution, the platform automatically loads the corresponding resources based on the size and density characteristics of the screen and extracts them from the logical pixels (DIP, used to define the interface layout) convert to physical pixels on the screen.

The following table lists some commonly used models on the screen supported by the Android platform, and shows how the system classifies them into different screen configurations. Some screen resolutions are not listed in the following list, but they are still classified into one of the following types.




Although the system supports multiple screens with different configurations, you do not have to provide different resources for them. The system has provided compatibility features that are robust enough (that is, to work normally in a variety of harsh environments and are not sensitive to environmental changes) to display your programs on a variety of screens. This is described in detail in the following document. If you need more information, see "Best Practices unrelated to the screen ".


Reference: http://developer.android.com/guide/practices/screens_support.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.