Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

WindowInsets.Builder

public static final class WindowInsets.Builder
extends Object

java.lang.Object
   ↳ android.view.WindowInsets.Builder


Builder for WindowInsets.

Summary

Public constructors

WindowInsets.Builder()

Creates a builder where all insets are initially consumed.

WindowInsets.Builder(WindowInsets insets)

Creates a builder where all insets are initialized from WindowInsets.

Public methods

WindowInsets build()

Builds a WindowInsets instance.

WindowInsets.Builder setDisplayCutout(DisplayCutout displayCutout)

Sets the display cutout.

WindowInsets.Builder setStableInsets(Insets stableInsets)

Sets the stable insets in pixels.

WindowInsets.Builder setSystemWindowInsets(Insets systemWindowInsets)

Sets system window insets in pixels.

Inherited methods

Public constructors

WindowInsets.Builder

public WindowInsets.Builder ()

Creates a builder where all insets are initially consumed.

WindowInsets.Builder

public WindowInsets.Builder (WindowInsets insets)

Creates a builder where all insets are initialized from WindowInsets.

Parameters
insets WindowInsets: the instance to initialize from. This value must never be null.

Public methods

build

public WindowInsets build ()

Builds a WindowInsets instance.

Returns
WindowInsets the WindowInsets instance. This value will never be null.

setDisplayCutout

public WindowInsets.Builder setDisplayCutout (DisplayCutout displayCutout)

Sets the display cutout.

Parameters
displayCutout DisplayCutout: the display cutout or null if there is none This value may be null.

Returns
WindowInsets.Builder itself

setStableInsets

public WindowInsets.Builder setStableInsets (Insets stableInsets)

Sets the stable insets in pixels.

The stable inset represents the area of a full-screen window that may be partially or fully obscured by the system UI elements. This value does not change based on the visibility state of those elements; for example, if the status bar is normally shown, but temporarily hidden, the stable inset will still provide the inset associated with the status bar being shown.

Parameters
stableInsets Insets: This value must never be null.

Returns
WindowInsets.Builder itself This value will never be null.

setSystemWindowInsets

public WindowInsets.Builder setSystemWindowInsets (Insets systemWindowInsets)

Sets system window insets in pixels.

The system window inset represents the area of a full-screen window that is partially or fully obscured by the status bar, navigation bar, IME or other system windows.

Parameters
systemWindowInsets Insets: This value must never be null.

Returns
WindowInsets.Builder itself This value will never be null.