WindowMetrics

public final class WindowMetrics


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

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

Summary

Public methods

boolean
equals(Object other)
final @NonNull Rect

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

final @NonNull WindowInsetsCompat

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

int
@NonNull String

Public methods

equals

public boolean equals(Object other)

getBounds

Added in 1.0.0
public final @NonNull Rect getBounds()

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
@NonNull Rect

window bounds in pixels.

getWindowInsets

Added in 1.1.0
@ExperimentalWindowApi
@RequiresApi(value = 30)
public final @NonNull WindowInsetsCompat getWindowInsets()

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

hashCode

public int hashCode()

toString

public @NonNull String toString()