WindowMetrics


class WindowMetrics


Metrics about a android.view.Window, consisting of its bounds.

This is obtained from WindowMetricsCalculator.computeCurrentWindowMetrics or WindowMetricsCalculator.computeMaximumWindowMetrics.

Summary

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

Rect

Returns a new Rect describing the bounds of the area the window occupies.

Float

Returns the logical density of the display this window is in.

Float

Returns the height of the Rect in DP units including insets from all system decorations.

Float

Returns the width of the Rect in DP units including insets from all system decorations.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

bounds

Added in 1.0.0
val boundsRect

Returns a new Rect describing the bounds of the area the window occupies.

Note that the size of the reported bounds can have different size than android.view.Display.getSize. This method reports the window size including insets from all system decorations, while android.view.Display.getSize reports the area excluding navigation bars and display cutout areas.

Returns
Rect

window bounds in pixels.

density

Added in 1.4.0-alpha05
val densityFloat

Returns the logical density of the display this window is in.

See also
density

heightDp

Added in 1.4.0-alpha05
val heightDpFloat

Returns the height of the Rect in DP units including insets from all system decorations.

widthDp

Added in 1.4.0-alpha05
val widthDpFloat

Returns the width of the Rect in DP units including insets from all system decorations.