WindowInsetsControllerCompat

public final class WindowInsetsControllerCompat
extends Object

java.lang.Object
   ↳ androidx.core.view.WindowInsetsControllerCompat


Provide simple controls of windows that generate insets. For SDKs >= 30, this class is a simple wrapper around WindowInsetsController. For lower SDKs, this class aims to behave as close as possible to the original implementation.

Summary

Nested classes

interface WindowInsetsControllerCompat.OnControllableInsetsChangedListener

Listener to be notified when the set of controllable WindowInsetsCompat.Type controlled by a WindowInsetsController changes. 

Constants

int BEHAVIOR_SHOW_BARS_BY_SWIPE

Option for setSystemBarsBehavior(int): Window would like to remain interactive when hiding navigation bars by calling hide(int) or WindowInsetsAnimationControllerCompat.setInsetsAndAlpha(Insets, float, float).

int BEHAVIOR_SHOW_BARS_BY_TOUCH

The default option for setSystemBarsBehavior(int).

int BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE

Option for setSystemBarsBehavior(int): Window would like to remain interactive when hiding navigation bars by calling hide(int) or WindowInsetsAnimationControllerCompat.setInsetsAndAlpha(Insets, float, float).

Public constructors

WindowInsetsControllerCompat(Window window, View view)

Public methods

void addOnControllableInsetsChangedListener(WindowInsetsControllerCompat.OnControllableInsetsChangedListener listener)

Adds a WindowInsetsController.OnControllableInsetsChangedListener to the window insets controller.

void controlWindowInsetsAnimation(int types, long durationMillis, Interpolator interpolator, CancellationSignal cancellationSignal, WindowInsetsAnimationControlListenerCompat listener)

Lets the application control window inset animations in a frame-by-frame manner by modifying the position of the windows in the system causing insets directly using WindowInsetsAnimationControllerCompat.setInsetsAndAlpha(Insets, float, float) in the controller provided by the given listener.

int getSystemBarsBehavior()

Retrieves the requested behavior of system bars.

void hide(int types)

Makes a set of windows causing insets disappear.

boolean isAppearanceLightNavigationBars()

Checks if the foreground of the navigation bar is set to light.

boolean isAppearanceLightStatusBars()

Checks if the foreground of the status bar is set to light.

void removeOnControllableInsetsChangedListener(WindowInsetsControllerCompat.OnControllableInsetsChangedListener listener)

Removes a WindowInsetsController.OnControllableInsetsChangedListener from the window insets controller.

void setAppearanceLightNavigationBars(boolean isLight)

If true, changes the foreground color of the navigation bars to light so that the items on the bar can be read clearly.

void setAppearanceLightStatusBars(boolean isLight)

If true, changes the foreground color of the status bars to light so that the items on the bar can be read clearly.

void setSystemBarsBehavior(int behavior)

Controls the behavior of system bars.

void show(int types)

Makes a set of windows that cause insets appear on screen.

static WindowInsetsControllerCompat toWindowInsetsControllerCompat(WindowInsetsController insetsController)

Wrap a WindowInsetsController into a WindowInsetsControllerCompat for compatibility purpose.

Inherited methods

Constants

BEHAVIOR_SHOW_BARS_BY_SWIPE

public static final int BEHAVIOR_SHOW_BARS_BY_SWIPE

Option for setSystemBarsBehavior(int): Window would like to remain interactive when hiding navigation bars by calling hide(int) or WindowInsetsAnimationControllerCompat.setInsetsAndAlpha(Insets, float, float).

When system bars are hidden in this mode, they can be revealed with system gestures, such as swiping from the edge of the screen where the bar is hidden from.

Constant Value: 1 (0x00000001)

BEHAVIOR_SHOW_BARS_BY_TOUCH

public static final int BEHAVIOR_SHOW_BARS_BY_TOUCH

The default option for setSystemBarsBehavior(int). System bars will be forcibly shown on any user interaction on the corresponding display if navigation bars are hidden by hide(int) or WindowInsetsAnimationControllerCompat.setInsetsAndAlpha(Insets, float, float).

Constant Value: 0 (0x00000000)

BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE

public static final int BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE

Option for setSystemBarsBehavior(int): Window would like to remain interactive when hiding navigation bars by calling hide(int) or WindowInsetsAnimationControllerCompat.setInsetsAndAlpha(Insets, float, float).

When system bars are hidden in this mode, they can be revealed temporarily with system gestures, such as swiping from the edge of the screen where t