WindowInsetsControllerCompat does not hide navigation bars

Viewed 440

I have an app with app bar and bottom navigation bars visible by default.

<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">

At some point I need to make the content fullscreen.

WindowCompat.setDecorFitsSystemWindows(window, false)
WindowInsetsControllerCompat(window, window.decorView).apply {
    hide(WindowInsetsCompat.Type.statusBars())
    systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}

This is supposed to hide both the status and navigation bars, but only the former gets hidden.

What am I missing here?

1 Answers

You missed adding the navigation bar with hide(WindowInsetsCompat.Type.navigationBars())

Related