O segundo Visualização do Desenvolvedor do Android 11 já está disponível, teste e compartilhe seu feedback.

WindowInsetsCompat.Builder

public static final class WindowInsetsCompat.Builder
extends Object

java.lang.Object
   ↳ androidx.core.view.WindowInsetsCompat.Builder


Builder for WindowInsetsCompat.

Summary

Public constructors

WindowInsetsCompat.Builder()

Creates a builder where all insets are initially consumed.

WindowInsetsCompat.Builder(WindowInsetsCompat insets)

Creates a builder where all insets are initialized from WindowInsetsCompat.

Public methods

WindowInsetsCompat build()

Builds a WindowInsetsCompat instance.

WindowInsetsCompat.Builder setDisplayCutout(DisplayCutoutCompat displayCutout)

Sets the display cutout.

WindowInsetsCompat.Builder setMandatorySystemGestureInsets(Insets insets)

Sets mandatory system gesture insets in pixels.

WindowInsetsCompat.Builder setStableInsets(Insets insets)

Sets the stable insets in pixels.

WindowInsetsCompat.Builder setSystemGestureInsets(Insets insets)

Sets system gesture insets in pixels.

WindowInsetsCompat.Builder setSystemWindowInsets(Insets insets)

Sets system window insets in pixels.

WindowInsetsCompat.Builder setTappableElementInsets(Insets insets)

Sets tappable element insets in pixels.

Inherited methods

Public constructors

WindowInsetsCompat.Builder

public WindowInsetsCompat.Builder ()

Creates a builder where all insets are initially consumed.

WindowInsetsCompat.Builder

public WindowInsetsCompat.Builder (WindowInsetsCompat insets)

Creates a builder where all insets are initialized from WindowInsetsCompat.

Parameters
insets WindowInsetsCompat: the instance to initialize from.

Public methods

build

public WindowInsetsCompat build ()

Builds a WindowInsetsCompat instance.

Returns
WindowInsetsCompat the WindowInsetsCompat instance.

setDisplayCutout

public WindowInsetsCompat.Builder setDisplayCutout (DisplayCutoutCompat displayCutout)

Sets the display cutout.

The cutout passed will only take effect when running on API 29 and above.

Parameters
displayCutout DisplayCutoutCompat: the display cutout or null if there is none

Returns
WindowInsetsCompat.Builder itself

setMandatorySystemGestureInsets

public WindowInsetsCompat.Builder setMandatorySystemGestureInsets (Insets insets)

Sets mandatory system gesture insets in pixels.

The mandatory system gesture insets represent the area of a window where mandatory system gestures have priority and may consume some or all touch input, e.g. due to the a system bar occupying it, or it being reserved for touch-only gestures.

In contrast to regular system gestures, mandatory system gestures cannot be overridden by ViewCompat.setSystemGestureExclusionRects(View, List).

The insets passed will only take effect when running on API 29 and above.

Parameters
insets Insets

Returns
WindowInsetsCompat.Builder itself

setStableInsets

public WindowInsetsCompat.Builder setStableInsets (Insets insets)

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.

The insets passed will only take effect when running on API 29 and above.

Parameters
insets Insets

Returns
WindowInsetsCompat.Builder itself

setSystemGestureInsets

public WindowInsetsCompat.Builder setSystemGestureInsets (Insets insets)

Sets system gesture insets in pixels.

The system gesture insets represent the area of a window where system gestures have priority and may consume some or all touch input, e.g. due to the a system bar occupying it, or it being reserved for touch-only gestures.

The insets passed will only take effect when running on API 29 and above.

Parameters
insets Insets

Returns
WindowInsetsCompat.Builder itself

setSystemWindowInsets

public WindowInsetsCompat.Builder setSystemWindowInsets (Insets insets)

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
insets Insets

Returns
WindowInsetsCompat.Builder itself

setTappableElementInsets

public WindowInsetsCompat.Builder setTappableElementInsets (Insets insets)

Sets tappable element insets in pixels.

The tappable element insets represent how much tappable elements must at least be inset to remain both tappable and visually unobstructed by persistent system windows.

The insets passed will only take effect when running on API 29 and above.

Parameters
insets Insets

Returns
WindowInsetsCompat.Builder itself