public final class

WindowInsetsCompat.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.core.view.WindowInsetsCompat.Builder

Overview

Builder for WindowInsetsCompat.

Summary

Constructors
publicBuilder()

Creates a builder where all insets are initially consumed.

publicBuilder(WindowInsetsCompat insets)

Creates a builder where all insets are initialized from WindowInsetsCompat.

Methods
public WindowInsetsCompatbuild()

Builds a WindowInsetsCompat instance.

public WindowInsetsCompat.BuildersetDisplayCutout(DisplayCutoutCompat displayCutout)

Sets the display cutout.

public WindowInsetsCompat.BuildersetInsets(int typeMask, Insets insets)

Sets the insets of a specific window type in pixels.

public WindowInsetsCompat.BuildersetInsetsIgnoringVisibility(int typeMask, Insets insets)

Sets the insets a specific window type in pixels, while ignoring its visibility state.

public WindowInsetsCompat.BuildersetMandatorySystemGestureInsets(Insets insets)

Sets mandatory system gesture insets in pixels.

public WindowInsetsCompat.BuildersetStableInsets(Insets insets)

Sets the stable insets in pixels.

public WindowInsetsCompat.BuildersetSystemGestureInsets(Insets insets)

Sets system gesture insets in pixels.

public WindowInsetsCompat.BuildersetSystemWindowInsets(Insets insets)

Sets system window insets in pixels.

public WindowInsetsCompat.BuildersetTappableElementInsets(Insets insets)

Sets tappable element insets in pixels.

public WindowInsetsCompat.BuildersetVisible(int typeMask, boolean visible)

Sets whether windows that can cause insets are currently visible on screen.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Creates a builder where all insets are initially consumed.

public Builder(WindowInsetsCompat insets)

Creates a builder where all insets are initialized from WindowInsetsCompat.

Parameters:

insets: the instance to initialize from.

Methods

public WindowInsetsCompat.Builder setSystemWindowInsets(Insets insets)

Deprecated: Use WindowInsetsCompat.Builder.setInsets(int, Insets) with WindowInsetsCompat.Type.systemBars().

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.

Returns:

itself

See also: WindowInsetsCompat.getSystemWindowInsets()

public WindowInsetsCompat.Builder setSystemGestureInsets(Insets insets)

Deprecated: Use WindowInsetsCompat.Builder.setInsets(int, Insets) with WindowInsetsCompat.Type.systemGestures().

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.

Returns:

itself

See also: WindowInsetsCompat.getSystemGestureInsets()

public WindowInsetsCompat.Builder setMandatorySystemGestureInsets(Insets insets)

Deprecated: Use WindowInsetsCompat.Builder.setInsets(int, Insets) with WindowInsetsCompat.Type.mandatorySystemGestures().

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.

Returns:

itself

See also: WindowInsetsCompat.getMandatorySystemGestureInsets()

public WindowInsetsCompat.Builder setTappableElementInsets(Insets insets)

Deprecated: Use WindowInsetsCompat.Builder.setInsets(int, Insets) with WindowInsetsCompat.Type.tappableElement().

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.

Returns:

itself

See also: WindowInsetsCompat.getTappableElementInsets()

public WindowInsetsCompat.Builder setInsets(int typeMask, Insets insets)

Sets the insets of a specific window type in pixels.

The insets represents the area of a a window that is partially or fully obscured by the system windows identified by typeMask.

Parameters:

typeMask: The bitmask of WindowInsetsCompat.Type to set the insets for.
insets: The insets to set.

Returns:

itself

See also: WindowInsetsCompat.getInsets(int)

public WindowInsetsCompat.Builder setInsetsIgnoringVisibility(int typeMask, Insets insets)

Sets the insets a specific window type in pixels, while ignoring its visibility state.

The insets represents the area of a a window that that may be partially or fully obscured by the system window identified by typeMask. 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 inset returned here will still provide the inset associated with the status bar being shown.

Parameters:

typeMask: The bitmask of WindowInsetsCompat.Type to set the insets for.
insets: The insets to set.

Returns:

itself

See also: WindowInsetsCompat.getInsetsIgnoringVisibility(int)

public WindowInsetsCompat.Builder setVisible(int typeMask, boolean visible)

Sets whether windows that can cause insets are currently visible on screen.

Parameters:

typeMask: The bitmask of WindowInsetsCompat.Type to set the visibility for.
visible: Whether to mark the windows as visible or not.

Returns:

itself

See also: WindowInsetsCompat.isVisible(int)

public WindowInsetsCompat.Builder setStableInsets(Insets insets)

Deprecated: Use WindowInsetsCompat.Builder.setInsetsIgnoringVisibility(int, Insets) with WindowInsetsCompat.Type.systemBars().

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.

Returns:

itself

See also: WindowInsetsCompat.getStableInsets()

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: the display cutout or null if there is none

Returns:

itself

See also: WindowInsetsCompat.getDisplayCutout()

public WindowInsetsCompat build()

Builds a WindowInsetsCompat instance.

Returns:

the WindowInsetsCompat instance.