After your app targets SDK 35, the system draws it behind the status bar and the navigation bar. On a gesture phone it often looks fine. On a phone with three buttons the last row can sit under the bar, or a bottom line can vanish. Here are three real bugs from my own apps, the fix for each, and the test routine I now use.
What edge-to-edge changed
Android's documentation says edge-to-edge is enforced once your app targets SDK 35 and runs on Android 15 or higher. The window then spans the whole display and draws behind the system bars. On earlier Android versions you get the same look by calling enableEdgeToEdge() in the activity. My apps target SDK 36, so on a current phone this is not optional.
- The system does not move your content. Your layout must read the insets, the areas covered by system UI, and pad itself.
- With enableEdgeToEdge() the gesture bar is transparent, but the three-button bar gets a translucent scrim by default.
- So one screen can look right with gestures and wrong with three buttons: a real bar sits over your last row.
Think of it as a change of contract. Before, the system reserved the bar areas and your layout lived in what remained. Now your layout owns the whole rectangle and you decide where the safe area starts. Most clipped UI bugs are places where nobody decided.
In Compose the two modifiers you need most are statusBarsPadding() for the top and navigationBarsPadding() for the bottom. All three bugs below are small mistakes around them.
Bug 1: the bar space belonged to an ad
In Calisan Asistani, an Android app, the home and settings screens have no banner ad. They slid under the navigation bar. I added navigationBarsPadding() to the page box and thought it was done.
A few days later it happened again. The real cause: the bottom space came only from the banner, written as Banner(Modifier.navigationBarsPadding()). When the banner was never drawn, because ads were off, consent was missing or nothing had loaded, the padding disappeared with it. The content went under the soft buttons.
The fix is to take the bar space from something that always exists. I put a box with navigationBarsPadding() at the bottom of the page, and the banner lives inside that box only on the screens that show one.
- Before: Banner(Modifier.navigationBarsPadding())
- After: Box(Modifier.fillMaxWidth().navigationBarsPadding()) { if (showBanner) Banner() }
Then I tested every screen with ads on and with ads off. The rule is simple: if a padding is attached to an element that can be absent, move it to its parent. This bug needs a specific state, no ad, so it only shows if you test that state on purpose.
Bug 2: padding in the wrong place
In Pentolings, the settings and statistics content flowed under the navigation buttons. The memory note I keep for this says it came back after I had fixed it in other games. The cause was the order of modifiers on a scrolling column.
- Wrong: Modifier.weight(1f).verticalScroll(state).navigationBarsPadding()
- Right: Modifier.weight(1f).navigationBarsPadding().verticalScroll(state)
My explanation from the notes: when the padding comes after verticalScroll, it is added inside the scrolled content. The visible window of the list still reaches the bottom edge of the screen, so the content shows through behind the buttons. When the padding comes first, the window itself ends above the bar. The Pentolings screens now use the second order, for example in HelpScreen.kt and Screens.kt.
A quick check for this bug: scroll to the very end of the screen. The last item must stop fully above the bar, with a little space. If it stops behind the bar, the order is wrong.
Bug 3: a weight squeezed to zero
The settings screen of Slinglings is a column with a title, switches, buttons, a decorative desk scene and a version line. The desk scene used weight(1f) to take whatever height was left, and the version line sat below it.
When the rows above filled the screen, nothing was left for the weight. The scene shrank to zero height and the version line at the very bottom was cut off. A taller phone hid the problem, so it only showed on a small screen.
- Before: DeskScene(Modifier.weight(1f))
- After: verticalScroll on the column, DeskScene(Modifier.height(150.dp))
The column is now scrollable and the scene has a fixed height. If the content does not fit, the user scrolls instead of losing a line. The same commit also stopped the version line from being a hard-coded text: it reads the real version name now.
There were two ways out: give flexible items a minimum height, or make the screen scrollable. I chose scrolling plus a fixed height, because on a small phone the decorative scene is the first thing to give up.
Which inset for which job
Compose offers several inset modifiers. You do not need all of them, but it helps to know what each one answers.
- statusBarsPadding(): keeps a top bar below the status bar.
- navigationBarsPadding(): keeps bottom content above the navigation bar, in gesture mode and in button mode.
- systemBarsPadding(): both of the above in one modifier.
- imePadding(): keeps a text field above the on-screen keyboard.
- safeDrawingPadding(): system bars, keyboard and display cutouts together.
- Scaffold: hands you an innerPadding value. If you ignore it, the content is not padded at all.
The Android documentation also lists display cutout insets and system gesture insets. The gesture insets matter when your own swipes start near the screen edge; the docs mention swiping in games as an example. My screens mostly use the first two modifiers. I have not needed more, so I cannot tell you from experience how the others behave in every case.
Large text and longer languages
Fixed heights are risky in the other direction too. A button with a fixed height cuts its label when the user sets a larger font. In Pentolings the shared button uses heightIn(min = ...) so it can grow with the text.
In my notes for other apps I also planned to test at 1.3x and 1.5x font size, because Spanish and Portuguese labels are longer than English ones. I have not run that test on every app yet, and I do not claim it. I treat it as a checklist item, not a result.
Do the arithmetic: at a 1.3 font scale a 14 sp label is drawn at about 18 sp, so the same words need roughly 30 percent more width. A label that fit on one line may now need two, or be cut.
In the Tilelings design notes I wrote a rule for long labels: one line only, a measurement test, and a fallback to 11 sp, checked on a small phone with a 1.3x font. That is a plan from the notes, not a measured result. The same notes list 48 dp touch targets, so a button never shrinks below a finger-sized area.
The test routine
Gesture navigation hides most of these bugs, so I test with the other mode. This is the routine.
- Use an emulator with three-button navigation (I use an Android 11 image).
- Raise the font size to 1.3 with: adb shell settings put system font_scale 1.3 (set it back to 1.0 afterwards).
- Open every screen, scroll to the very bottom and take a screenshot.
- Repeat with the longest language and with a small screen.
- Turn ads off and on, because optional elements change the layout.
Before each release I now ask three questions. Is the last item of every scrolling screen fully above the bar? Does any bottom space depend on an optional element? Does any flexible item have a fixed minimum? Each step above reproduces one bug: three buttons show bugs 1 and 2, a small screen shows bug 3, a large font shows the cut labels, and ads off shows bug 1 again.
FAQ
From which target SDK is edge-to-edge enforced?
According to the Android documentation, edge-to-edge is enforced on Android 15 (API level 35) and higher once your app targets SDK 35.
Does navigationBarsPadding() go before or after verticalScroll?
Before. Placed after, the padding scrolls with the content and the list still shows behind the navigation bar.
Why does my UI look fine on gesture navigation but break with three buttons?
With three buttons a real, translucent navigation bar covers the bottom of the window, so any content without bottom padding sits under it.
Why did my bottom line disappear on a small screen?
A weight(1f) item shrinks to zero when the other items fill the screen. Make the screen scrollable and give that item a fixed height.
Top comments (12)
The banner bug is the one that hides in review: navigationBarsPadding() on an optional ad vanishes when the ad is off, and gesture navigation never shows it. Putting the padding on a parent that always exists, and putting it before verticalScroll, are the two rules I'd keep. Testing with three-button navigation and ads off is the only way those two stay fixed.
Exactly, "ads off + three buttons" is the combination that exposed it for me. Thanks for reading so closely.
Ads off plus three button nav is a nasty pairing because neither shows up in the default emulator setup. A screenshot test that runs once with gesture nav and once with three button nav would keep the banner case from quietly coming back. Did the fix end up as windowInsetsPadding on the banner container itself, or on the parent Scaffold?
It's neither, actually. The fix is a plain Box at the bottom of the page column with navigationBarsPadding(), and the banner is drawn inside it only on the screens that show one.
So the inset sits on a container that always exists, and the banner is optional inside it. There's no Scaffold in that app.
And your screenshot-test idea is the right next step: right now my gesture vs three-button check is a manual emulator routine, not an automated test,
which is exactly why the banner case could come back unnoticed. I'll look at turning it into a test that runs both modes.
Putting the inset on a Box that always exists and keeping the banner optional inside it means the padding no longer depends on whether an ad loaded. When you write the test I'd run it with the banner present and absent as well, because the empty Box still reserving the nav bar height is the case a gesture nav run would never show you.
Right, and that reserved height is intended: with no banner the Box is empty but still holds the nav bar inset, so the content ends above the bar.
What the test has to prove is that this height is identical with the banner present and absent. A layout that shifts when the ad loads would mean the padding leaked back onto the banner. So the matrix is two nav modes times two banner states, and I'd assert on the bottom of the last item rather than only eyeballing a screenshot. It's still a manual emulator routine for me today, so I'll write it down as a four-case checklist first and automate it after.
Bug 2 is the one I'd have gotten wrong — I'd have assumed navigationBarsPadding() works the same anywhere in the modifier chain. Have you run into the same ordering trap with imePadding() inside a scrolling column, or does the keyboard resizing the window make that one more forgiving? And in your test routine, does the Android 11 emulator catch anything the 1.3x font scale run doesn't, or is it mainly there for the 3-button bar?
Honest answer: I have not tested the ordering with imePadding() inside a scrolling column, so I cannot say from experience. I only know it from the docs that the keyboard is a separate inset, and the same logic (padding before verticalScroll) should apply, but please check it on a real device.
On the emulator: it is mainly there for the three-button bar. The Android 11 image gives me that bar quickly. The 1.3x font scale is a separate run on top of it, and it catches different bugs (cut labels, buttons with a fixed height), not the bar ones. So the two runs find different things.
Bug 1 is such a good example of a layout that only breaks in one specific state. Moving the inset to something that always exists is a rule worth keeping. One trade-off with putting navigationBarsPadding() before verticalScroll: the scroll viewport ends above the bar, so content never passes behind the translucent bar. If you want the full edge-to-edge look on a LazyColumn, passing WindowInsets.navigationBars.asPaddingValues() as contentPadding lets items scroll behind the bar while the last one still stops above it.
Thanks, that is a good point and I had not considered it. My screens are mostly plain scrolling columns, so I kept the whole viewport above the bar. For a LazyColumn, contentPadding with the navigationBars insets gives the nicer edge-to-edge look: items pass behind the translucent bar and the last one still stops above it. I will use that where a list is the main content.
Useful breakdown. One more trap I have seen alongside Bug 2: nested Scaffolds. If a screen-level Scaffold sits inside an app-level Scaffold and both apply innerPadding, the bottom inset gets added twice and you end up with a gap above the bar instead of content under it. Calling Modifier.consumeWindowInsets(innerPadding) on the outer content stops the inner layout from padding again. Worth adding to the three-button test run, since the double gap is easy to miss on gesture navigation too.
Good one, thanks. I haven't hit that one because my apps don't use Scaffold at all, they apply the insets by hand, so I can't say anything from experience about the double bottom inset.
It's worth adding to the three-button checklist for anyone using nested Scaffolds, and a double gap above the bar is exactly the kind of thing gesture navigation hides.