Interface: DisplayMetrics


CloudControl Pro 9 Docs / device / DisplayMetrics

Interface: DisplayMetrics

device.DisplayMetrics

设备的显示相关信息。

See

https://developer.android.com/reference/android/util/DisplayMetrics

Table of contents

Properties

Properties

density

density: number

The logical density of the display. This is a scaling factor for the Density Independent Pixel unit, where one DIP is one pixel on an approximately 160 dpi screen (for example a 240x320, 1.5"x2" screen), providing the baseline of the system's display. Thus on a 160dpi screen this density value will be 1; on a 120 dpi screen it would be .75; etc.

This value does not exactly follow the real screen size (as given by xdpi and ydpi), but rather is used to scale the size of the overall UI in steps based on gross changes in the display dpi. For example, a 240x320 screen will have a density of 1 even if its width is 1.8", 1.3", etc. However, if the screen resolution is increased to 320x480 but the screen size remained 1.5"x2" then the density would be increased (probably to 1.5).

See

https://developer.android.com/reference/android/util/DisplayMetrics#density


densityDpi

densityDpi: number

The screen density expressed as dots-per-inch.

See

https://developer.android.com/reference/android/util/DisplayMetrics#densityDpi


heightPixels

heightPixels: number

Display height, in pixels.


scaledDensity

scaledDensity: number

A scaling factor for fonts displayed on the display. This is the same as density, except that it may be adjusted in smaller increments at runtime based on a user preference for the font size.

See

https://developer.android.com/reference/android/util/DisplayMetrics#scaledDensity


widthPixels

widthPixels: number

Display width, in pixels.


xdpi

xdpi: number

The screen density expressed as dots-per-inch in the X dimension.

See

https://developer.android.com/reference/android/util/DisplayMetrics#xdpi


ydpi

ydpi: number

The screen density expressed as dots-per-inch in the Y dimension.

See

https://developer.android.com/reference/android/util/DisplayMetrics#ydpi