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

WindowInsetsConnectionKt

public final class WindowInsetsConnectionKt


Summary

Public methods

static final @NonNull Modifier

Controls the soft keyboard as a nested scrolling on Android R and later.

Public methods

imeNestedScroll

@ExperimentalLayoutApi
public static final @NonNull Modifier imeNestedScroll(@NonNull Modifier receiver)

Controls the soft keyboard as a nested scrolling on Android R and later. This allows the user to drag the soft keyboard up and down.

After scrolling, the IME will animate either to the fully shown or fully hidden position, depending on the position and fling.

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.imeNestedScroll
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Text
import androidx.compose.ui.Modifier

LazyColumn(
    modifier = Modifier
        .fillMaxSize() // fill the window
        .imePadding() // pad out the bottom for the IME
        .imeNestedScroll(), // scroll IME at the bottom
    reverseLayout = true // First item is at the bottom
) {
    // content
    items(50) {
        Text("Hello World")
    }
}