Android and mobile engineer writing about shipping AI-assisted Android and iOS code: release gates, maintainability, and the decisions that still need a human.
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.
I'm an independent mobile developer building for Android and iPhone. I design, build and publish my games and apps on my own. Most are free and none of them asks you to create an account.
Android and mobile engineer writing about shipping AI-assisted Android and iOS code: release gates, maintainability, and the decisions that still need a human.
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?
I'm an independent mobile developer building for Android and iPhone. I design, build and publish my games and apps on my own. Most are free and none of them asks you to create an account.
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.
Android and mobile engineer writing about shipping AI-assisted Android and iOS code: release gates, maintainability, and the decisions that still need a human.
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.
I'm an independent mobile developer building for Android and iPhone. I design, build and publish my games and apps on my own. Most are free and none of them asks you to create an account.
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?
I'm an independent mobile developer building for Android and iPhone. I design, build and publish my games and apps on my own. Most are free and none of them asks you to create an account.
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.
I'm an independent mobile developer building for Android and iPhone. I design, build and publish my games and apps on my own. Most are free and none of them asks you to create an account.
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.
Arpit Mishra is the SEO Executive at Dev Technosys, a fintech app development company in US, UK, UAE, New Zealand and India. The company specializes in building custom healthcare applications such as
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.
I'm an independent mobile developer building for Android and iPhone. I design, build and publish my games and apps on my own. Most are free and none of them asks you to create an account.
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.
We're a place where coders share, stay up-to-date and grow their careers.
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.