Why the ModalBottomSheet is behind the navigation bar?

I need to implement a ModalBottomSheet in my app. But before doing that, I test it in a test app following this example.

The problem is that the ModalBottomSheet does not appear above the navigation bar. It’s just overloped:
enter image description here

I tried to add the android:windowSoftInputMode="adjustResize" into the AndroidManifest.xml and

    WindowCompat.setDecorFitsSystemWindows(window, true) // -> no matter true or false. The same result.

into the MainActivity.kt.
Also, I tried to play with windowInsets parameter of the ModalBottomSheet like

...,
windowInsets = WindowInsets.navigationBars
...,

But no results.

However, if the user uses Gesture navigation instead of 3-button navigation, than it looks ok, which actually makes sence:
enter image description here

But I need to make it work correctly for 3-button navigation, too.

How to achieve that?

Any help highly appricited.

Leave a Comment