{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

WindowInsets.Companion

public static class WindowInsets.Companion


Summary

Extension functions

static final boolean

true when the navigationBars are being displayed, irrespective of whether they intersects with the Window.

static final boolean

true when the statusBars are being displayed, irrespective of whether they intersects with the Window.

static final boolean

true when the systemBars are being displayed, irrespective of whether they intersects with the Window.

static final @NonNull WindowInsets

For the WindowInsetsCompat.Type.captionBar.

static final @NonNull WindowInsets

The insets that the WindowInsetsCompat.Type.captionBar will consume if shown.

static final @NonNull WindowInsets

For the WindowInsetsCompat.Type.displayCutout.

static final @NonNull WindowInsets

For the WindowInsetsCompat.Type.ime.

static final @NonNull WindowInsets

The WindowInsets for the IME before the IME started animating in.

static final @NonNull WindowInsets

The WindowInsets for the IME when the animation completes, if it is allowed to complete successfully.

static final @NonNull WindowInsets

For the WindowInsetsCompat.Type.mandatorySystemGestures.

static final @NonNull WindowInsets

For the WindowInsetsCompat.Type.navigationBars.

static final @NonNull WindowInsets

The insets that WindowInsetsCompat.Type.navigationBars will consume if shown.

static final @NonNull WindowInsets

The insets that include all areas that may be drawn over or have gesture confusion, including everything in safeDrawing and safeGestures.

static final @NonNull WindowInsets

The insets that include areas where content may be covered by other drawn content.

static final @NonNull WindowInsets

The insets that include areas where gestures may be confused with other input, including system gestures, mandatory system gestures, rounded display areas, and tappable areas.

static final @NonNull WindowInsets

For the WindowInsetsCompat.Type.statusBars.

static final @NonNull WindowInsets

The insets that WindowInsetsCompat.Type.statusBars will consume if shown.

static final @NonNull WindowInsets

For the WindowInsetsCompat.Type.systemBars.

static final @NonNull WindowInsets

The insets that WindowInsetsCompat.Type.systemBars will consume if shown.

static final @NonNull WindowInsets

For the WindowInsetsCompat.Type.systemGestures.

static final @NonNull WindowInsets

For the WindowInsetsCompat.Type.tappableElement.

static final @NonNull WindowInsets

The insets that WindowInsetsCompat.Type.tappableElement will consume if active.

static final @NonNull WindowInsets

The insets for the curved areas in a waterfall display.

static final boolean

true when the caption bar is being displayed, irrespective of whether it intersects with the Window.

static final boolean

true when the soft keyboard is being displayed, irrespective of whether it intersects with the Window.

static final boolean

true when the tappableElement is being displayed, irrespective of whether they intersects with the Window.

Extension functions

WindowInsetsKt.getAreNavigationBarsVisible

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final boolean WindowInsetsKt.getAreNavigationBarsVisible(
    @NonNull WindowInsets.Companion receiver
)

true when the navigationBars are being displayed, irrespective of whether they intersects with the Window.

WindowInsetsKt.getAreStatusBarsVisible

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final boolean WindowInsetsKt.getAreStatusBarsVisible(
    @NonNull WindowInsets.Companion receiver
)

true when the statusBars are being displayed, irrespective of whether they intersects with the Window.

WindowInsetsKt.getAreSystemBarsVisible

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final boolean WindowInsetsKt.getAreSystemBarsVisible(
    @NonNull WindowInsets.Companion receiver
)

true when the systemBars are being displayed, irrespective of whether they intersects with the Window.

WindowInsetsKt.getCaptionBar

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getCaptionBar(@NonNull WindowInsets.Companion receiver)

For the WindowInsetsCompat.Type.captionBar.

WindowInsetsKt.getCaptionBarIgnoringVisibility

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getCaptionBarIgnoringVisibility(
    @NonNull WindowInsets.Companion receiver
)

The insets that the WindowInsetsCompat.Type.captionBar will consume if shown. If it cannot be shown then this will be empty.

WindowInsetsKt.getDisplayCutout

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getDisplayCutout(
    @NonNull WindowInsets.Companion receiver
)

For the WindowInsetsCompat.Type.displayCutout. This insets represents the area that the display cutout (e.g. for camera) is and important content should be excluded from.

WindowInsetsKt.getIme

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getIme(@NonNull WindowInsets.Companion receiver)

For the WindowInsetsCompat.Type.ime. On API level 23 (M) and above, the soft keyboard can be detected and ime will update when it shows. On API 30 (R) and above, the ime insets will animate synchronously with the actual IME animation.

Developers should set android:windowSoftInputMode="adjustResize" in their AndroidManifest.xml file and call WindowCompat.setDecorFitsSystemWindows(window, false) in their android.app.Activity.onCreate.

WindowInsetsKt.getImeAnimationSource

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getImeAnimationSource(
    @NonNull WindowInsets.Companion receiver
)

The WindowInsets for the IME before the IME started animating in. The current animated value is WindowInsets.Companion.ime.

This will be the same as imeAnimationTarget when there is no IME animation in progress.

WindowInsetsKt.getImeAnimationTarget

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getImeAnimationTarget(
    @NonNull WindowInsets.Companion receiver
)

The WindowInsets for the IME when the animation completes, if it is allowed to complete successfully. The current animated value is WindowInsets.Companion.ime.

This will be the same as imeAnimationSource when there is no IME animation in progress.

WindowInsetsKt.getMandatorySystemGestures

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getMandatorySystemGestures(
    @NonNull WindowInsets.Companion receiver
)

For the WindowInsetsCompat.Type.mandatorySystemGestures. These insets represents the space where system gestures have priority over application gestures.

WindowInsetsKt.getNavigationBars

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getNavigationBars(
    @NonNull WindowInsets.Companion receiver
)

For the WindowInsetsCompat.Type.navigationBars. These insets represent where system UI places navigation bars. Interactive UI should avoid the navigation bars area.

WindowInsetsKt.getNavigationBarsIgnoringVisibility

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getNavigationBarsIgnoringVisibility(
    @NonNull WindowInsets.Companion receiver
)

The insets that WindowInsetsCompat.Type.navigationBars will consume if shown. These insets represent where system UI places navigation bars. Interactive UI should avoid the navigation bars area. If navigation bars cannot be shown, then this will be empty.

WindowInsetsKt.getSafeContent

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getSafeContent(@NonNull WindowInsets.Companion receiver)

The insets that include all areas that may be drawn over or have gesture confusion, including everything in safeDrawing and safeGestures.

WindowInsetsKt.getSafeDrawing

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getSafeDrawing(@NonNull WindowInsets.Companion receiver)

The insets that include areas where content may be covered by other drawn content. This includes all system bars, display cutout, and soft keyboard.

WindowInsetsKt.getSafeGestures

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getSafeGestures(
    @NonNull WindowInsets.Companion receiver
)

The insets that include areas where gestures may be confused with other input, including system gestures, mandatory system gestures, rounded display areas, and tappable areas.

WindowInsetsKt.getStatusBars

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getStatusBars(@NonNull WindowInsets.Companion receiver)

For the WindowInsetsCompat.Type.statusBars.

WindowInsetsKt.getStatusBarsIgnoringVisibility

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getStatusBarsIgnoringVisibility(
    @NonNull WindowInsets.Companion receiver
)

The insets that WindowInsetsCompat.Type.statusBars will consume if shown. If the status bar can never be shown, then this will be empty.

WindowInsetsKt.getSystemBars

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getSystemBars(@NonNull WindowInsets.Companion receiver)

For the WindowInsetsCompat.Type.systemBars.

WindowInsetsKt.getSystemBarsIgnoringVisibility

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getSystemBarsIgnoringVisibility(
    @NonNull WindowInsets.Companion receiver
)

The insets that WindowInsetsCompat.Type.systemBars will consume if shown.

If system bars can never be shown, then this will be empty.

WindowInsetsKt.getSystemGestures

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getSystemGestures(
    @NonNull WindowInsets.Companion receiver
)

For the WindowInsetsCompat.Type.systemGestures.

WindowInsetsKt.getTappableElement

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getTappableElement(
    @NonNull WindowInsets.Companion receiver
)

For the WindowInsetsCompat.Type.tappableElement.

WindowInsetsKt.getTappableElementIgnoringVisibility

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getTappableElementIgnoringVisibility(
    @NonNull WindowInsets.Companion receiver
)

The insets that WindowInsetsCompat.Type.tappableElement will consume if active.

If there are never tappable elements then this is empty.

WindowInsetsKt.getWaterfall

@Composable
@NonRestartableComposable
public static final @NonNull WindowInsets WindowInsetsKt.getWaterfall(@NonNull WindowInsets.Companion receiver)

The insets for the curved areas in a waterfall display.

WindowInsetsKt.isCaptionBarVisible

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final boolean WindowInsetsKt.isCaptionBarVisible(
    @NonNull WindowInsets.Companion receiver
)

true when the caption bar is being displayed, irrespective of whether it intersects with the Window.

WindowInsetsKt.isImeVisible

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final boolean WindowInsetsKt.isImeVisible(@NonNull WindowInsets.Companion receiver)

true when the soft keyboard is being displayed, irrespective of whether it intersects with the Window.

WindowInsetsKt.isTappableElementVisible

@ExperimentalLayoutApi
@Composable
@NonRestartableComposable
public static final boolean WindowInsetsKt.isTappableElementVisible(
    @NonNull WindowInsets.Companion receiver
)

true when the tappableElement is being displayed, irrespective of whether they intersects with the Window.