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?)
WindowInsetsCompat

Returns the WindowInsetsCompat of the area associated with this window or visual context.

open Int
open String

Public properties

Rect

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

Public functions

equals

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

getWindowInsets

Added in 1.1.0
@ExperimentalWindowApi
@RequiresApi(value = 30)
fun getWindowInsets(): WindowInsetsCompat

Returns the WindowInsetsCompat of the area associated with this window or visual context.

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 Display#getSize. This method reports the window size including all system decorations, while Display#getSize reports the area excluding navigation bars and display cutout areas.

Returns
Rect

window bounds in pixels.