DisplayMetrics
device.DisplayMetrics
Snapshot of the default display’s size and density (same idea as Android’s DisplayMetrics).
See also
Table of contents
Properties
Properties
density
density:number
Logical density scale for dp ↔ px (1.0 ≈ 160 dpi baseline). Used for UI scaling; not always equal to physical DPI—compare xdpi / ydpi.
See also
densityDpi
densityDpi:number
Generalized density bucket in dpi (e.g. DENSITY_MEDIUM, DENSITY_HIGH). Rounds the physical DPI into the discrete buckets the framework uses for resources.
See also
heightPixels
heightPixels:number
Full display height in pixels (may exclude system decorations depending on how metrics were obtained).
scaledDensity
scaledDensity:number
Like density, but includes the user’s font-scale preference for sp ↔ px conversion.
See also
widthPixels
widthPixels:number
Full display width in pixels.
xdpi
xdpi:number
Physical pixels per inch along X (when reported by the display).
See also
ydpi
ydpi:number
Physical pixels per inch along Y (when reported by the display).
See also
