Android unit details 2 (small translation)

Source: Internet
Author: User
Document directory
  • Terms and concepts

Http://developer.android.com/guide/practices/screens_support.html

Terms and concepts
Screen size
Actual physical size, measured as the screen's diagonal.

For simplicity, Android groups all actual screen sizes into four generalized sizes: small, normal, large, and extra large.

Screen density
The quantity of pixels within a physical area of the screen; usually referred to as dpi (dots per inch ). for example, a "low" density screen has fewer pixels within a given physical area, compared to a "normal" or "high" density screen.

For simplicity, Android groups all actual screen densities into four generalized densities: low, medium, high, and extra high.

Orientation
The orientation of the screen from the user's point of view. this is either landscape or portrait, meaning that the screen's aspect ratio is either wide or tall, respectively. be aware that not only do different devices operate in different orientations by default, but the orientation can change at runtime when the user rotates the device.
Resolution
The total number of physical pixels on a screen. when adding support for multiple screens, applications do not work directly with resolution; applications shocould be concerned only with screen size and density, as specified by the generalized size and density groups.
Density-independent pixel (dp)
A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way.

The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium" density screen. at runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. the conversion of dp units to screen pixels is simple:px = dp * (dpi / 160). For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels. you shoshould always use dp units when defining your application's UI, to ensure proper display of your UI on screens with different densities.

Terms and concepts

Screen Size:

The actual physical size is measured in diagonal lines of the screen.

For simplicity, android organizes all the screen sizes into four general sizes: small, normal, large, and extra large.

Screen density (dpi ):

The number of pixels in the physical area of the screen. It usually corresponds to dpi. For example, the low standard screen density is less than the normal and high standard pixels in the same screen.

To make it easier, andorid organizes all the actual screen density into four general density: low, medium, high, extra high.

Direction:

The screen direction comes from the user's viewing angle, which can be either horizontal or vertical, and corresponds to the ratio of the screen width to height. you need to know that not only the default operation direction of different devices is different, but also the orientation can be changed when the user rotates the screen.

Resolution:

The total number of heat treatment pixels for a screen. to support multiple screens, applications do not directly deal with resolutions. applications should consider dealing with the size and density of the screen, because they are generalized into a general size and density group by the android system.

Density-independent pixel (dp)

A virtual pixel unit. You can use them in your UI unit to indicate the dimensions and positions of the layout in a way unrelated to density.

A density-independent pixel is a physical pixel number of a 160dpi screen. it is the bottom line density that the system assumes for the medium density screen. When running, if necessary, the system will transparently process the scaling of any dp unit based on the actual screen density of the user, dp

Px conversion is simple: px = dp * (dpi/160 ). for example, if 1dp is PX on a DPI screen, you should always use dp units in your application UI. to ensure that your UI will adapt to different screen density.

Range of screens supported

Starting with Android 1.6 (API Level 4), Android provides support for multiple screen sizes and densities, reflecting the specified different screen invocations that a device may be have. you can use features of the Android system to optimize your application's user interface for each screen configuration and ensure that your application not only renders properly, but provides the best user experience possible on each screen.

To simplify the way that you design your user interfaces for multiple screens, Android divides the range of actual screen sizes and densities:

  • A set of four generalizedSizes:Small,Normal,Large, AndXlarge

    Note:Beginning with Android 3.2 (API level 13), these size groups are deprecated in favor of a new technique for managing screen sizes based on the available screen width. if you're developing for Android 3.2 and greater, see Declaring Tablet Layouts for Android 3.2 for more information.

  • A set of four generalizedDensities:Ldpi(Low ),Mdpi(Medium ),Hdpi(High), andXhdpi(Extra high)

The generalized sizes and densities are arranged around a baseline configuration that isNormalSize andMdpi(Medium) density. this baseline is based upon the screen configuration for the first Android-powered device, the T-Mobile G1, which has an HVGA screen (until Android 1.6, this was the only screen configuration that Android supported ).

Each generalized size and density spans a range of actual screen sizes and densities. For example, two devices that both report a screen sizeNormalMight have actual screen sizes and aspect ratios that are slightly different when measured by hand. Similarly, two devices that report a screen densityHdpiMight have real pixel densities that are slightly different. android makes these differences abstract to applications, so you can provide UI designed for the generalized sizes and densities and let the system handle any final adjustments as necessary. figure 1 when strates how different sizes and densities are roughly categorized into the different size and density groups.

Figure 1.Authentication of how Android roughly maps actual sizes and densities to generalized sizes and densities (figures are not exact ).

Supported screen range

Since android 1.6, android provides support for various screen sizes and density. it reflects many different screen configurations used by devices. you can use these features of the android system to optimize your application interface for every screen configuration, make your application not only render properly, but also provide the best user experience for each screen.

To simplify your multi-screen user interface design, android divides a series of screen sizes and passwords, as shown below:

Four general dimensions:Small,Normal,Large, AndXlarge.

Note: These sizes have expired since android3.2 to support new screen management technologies. if you are a developer of android3.2 or later, see the link Declaring Tablet Layouts for Android 3.2 for more information ..

Four screen density types: ldpi, mdpi, hdpi, and xhdpi.

These general dimensions and density are designed based on the normal size and mdip density. this design standard applies to the first android phone. htc G1. this phone has an HVGA (half VGA) screen (until android1.6, which is a unique screen configuration supported by android ). each generalized dimension and density spans a series of actual screen sizes and density. for example ,...

Related Article

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.