📚 Encyclopedia

Android · updated 2026-10-26

Android window insets, the soft keyboard, and edge-to-edge

androidcomposeinsetsimeedge-to-edgewindowSoftInputMode

How an app's layout reacts to the on-screen keyboard and the system bars depends on windowSoftInputMode, inset handling, and (since Android 15) mandatory edge-to-edge. Three real bugs show the traps.

Compose app: whole screen pans off when the keyboard opens

Symptom: opening the keyboard shoved the compose bar to the top, with the app bar and messages gone and a keyboard-height dead strip above the IME. It looked like a Compose layout bug; it was not.

View-based app on Android 15: bars cover the UI

targetSdk 35 on Android 15 enforces edge-to-edge. Activities built from plain view trees with no inset handling had translucent system bars over their content, and the theme's ActionBar buried the app's own toolbar. Fix: a helper that pads the root by systemBars | displayCutout | ime insets, a NoActionBar theme, dark bar icons where needed. Put the padding on an outer shell view, not on a root whose padding other code also sets, or the listener clobbers it.

Input method views

An IME that rebuilds its input view (for example on a theme change) must call requestApplyInsets() on the new view, or its bottom row sits under the navigation bar.

On Android 15+ the IME window is also edge-to-edge and must pad itself above the navigation bar. Some OEM builds misreport that inset: on a OnePlus (OxygenOS, 3-button navigation) the keyboard's space-bar row was sometimes hidden behind the nav bar because systemBars() insets came back as 0 (bars "hidden") while the bar was drawn. Robust version: pad by the max of the visible systemBars | displayCutout bottom inset and getInsetsIgnoringVisibility(navigationBars()), and re-apply rootWindowInsets plus requestApplyInsets() in onWindowShown() on every show. On the emulator, cmd overlay enable com.android.internal.systemui.navbar.threebutton switches to 3-button navigation for testing.

See also

Linked from

Sources: message memory (project_bugs_fixed v2.13.1), phone memory (kid-phone-project, guardian 1.1.3), keyboard memory (history v1.6.0), keyboard memory (v1.28.1), tldr post #1825