• android单位详解2(小翻译)


    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 should 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 should always use dp units when defining your application's UI, to ensure proper display of your UI on screens with different densities.

    术语和概念

    屏幕尺寸:

           实际的物理尺寸, 用屏幕的对角线测量.

           为了更加简单, android 组织了所有的屏幕尺寸成四个一般化的尺寸: small, normal,large,extra large.

    屏幕密度(dpi):

          屏幕的物理的区域的像素数量.通常和dpi相对应. 例如,low标准的屏幕密度在同样屏幕下比normal和high标准下的像素数更少.

          也是为了更加简单, andorid又组织了所有实际的屏幕密度成四个一般化的密度: low ,medium, high ,extra high.

    方向 :

          屏幕的方向来自于用户的观察角度, 方向可以是横向也可以是纵向, 相对应的就是屏幕的宽高的比例. 要知道不仅不同设备的默认的操作方向不同, 而且当用户旋转屏幕的时候方向可以改变.

    分辨率:

          指一个屏幕的热处理像素的总数. 当要对多种屏幕支持时,应用程序不直接与分辨率打交道.应用程序应该考虑和屏幕的尺寸和密度打交道,因为它们被android系统一般化为一般的尺寸和密度组.

    独立于密度的像素(dp)

          指一个虚拟的像素单元,你可以在你的UI单元里使用它们表示布局的维度和位置以一种和密度无关的方式.

          一个独立于密度的像素就是一个160dpi的屏幕的一个物理像素数.它是系统对于medium密度屏幕的假定的底线密度,在运行时,如果必要, 系统会根据用户实际的屏幕密度透明的处理任何dp单元的缩放,dp到

          px的转换是简单的: px = dp*(dpi/160). 例如, 在一个240dpi的屏幕上, 1dp等于1.5px, 在你的应用程序UI你应该总是使用dp单元.来确保你的UI会适应不同的屏幕密度.

    Range of screens supported

    Starting with Android 1.6 (API Level 4), Android provides support for multiple screen sizes and densities, reflecting the many different screen configurations that a device may 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 into:

    • A set of four generalized sizes: small, normal, large, and xlarge

      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 generalized densities: ldpi (low), mdpi (medium), hdpi (high), and xhdpi (extra high)

    The generalized sizes and densities are arranged around a baseline configuration that is a normal size and mdpi (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 size of normal might have actual screen sizes and aspect ratios that are slightly different when measured by hand. Similarly, two devices that report a screen density of hdpi might 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 illustrates how different sizes and densities are roughly categorized into the different size and density groups.

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

    屏幕支持的范围

    从安卓1.6开始, android提供对多种屏幕的尺寸和密度的支持.反映了设备使用的许多不同屏幕的配置.你可以使用android系统的这些特性来对每一种屏幕配置都能优化你的应用程序界面,使你的应用程序不仅适当的渲染而且对每一种屏幕提供最好的用户体验.

    为了简化你适应多屏幕用户界面的设计 , android划分了一系列的屏幕尺寸和密码,如下:

         四种泛化的尺寸: small, normal, large, and xlarge.

         注意: 从android3.2开始,这些尺寸都过时了,为了支持新的管理屏幕的技术. 如果你是android3.2或以上的开发者, 看 Declaring Tablet Layouts for Android 3.2 这个链接得到更多的信息..

         四种屏幕的密度: ldpi, mdpi,hdpi ,xhdpi.

    这些泛化的尺寸和密度是根据正常尺寸和mdip密度而设计的. 这种设计的标准应用于第一款android手机, htc G1. 这个手机有一个HVGA(half VGA)屏幕,(一直到android1.6, 这都是android支持一唯一的屏幕配置). 每一种泛化的尺寸和密度跨越了一系列的实际的屏幕尺寸和密度. 例如, ...

  • 相关阅读:
    AngularJS ng-show 指令
    JavaScript 表单
    input type=”datetime”-local (Elements) – HTML 中文开发手册
    CSS3 overflow-y 属性
    ASP CodePage 属性
    Spring Boot的特性:外部化配置和配置随机值
    Java 之 Properties类 属性集
    Java 之 IO 异常的处理【了解】
    Java 之 字符输出流[Writer]
    Java 之 字符输入流[Reader]
  • 原文地址:https://www.cnblogs.com/olvo/p/2517795.html
Copyright © 2020-2023  润新知