Home > Back-end >  Hide DrawerLayout system bars but layouts remain
Hide DrawerLayout system bars but layouts remain

Time:11-24

I can't figure out why the system bars still remain in landscape although I have used

WindowCompat.setDecorFitsSystemWindows(window, true)
WindowInsetsControllerCompat(window, nView).let { controller ->
    controller.hide(WindowInsetsCompat.Type.systemBars())
    controller.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}

But it seems it just hides the 'icons enter image description here

enter image description here

Any idea is appreciated

Later Edit: Made a test and realized is from the activity layout androidx.drawerlayout.widget.DrawerLayout

CodePudding user response:

You can try to setDecorFitsSystemWindows(window,false) to false. This is working fine for my app.

 private fun hideSystemUi() {
        WindowCompat.setDecorFitsSystemWindows(window, false)
        WindowInsetsControllerCompat(window, binding.videoView).let { controller ->
            controller.hide(WindowInsetsCompat.Type.systemBars())
            controller.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
        }
    }

CodePudding user response:

had set android:fitsSystemWindows="true"

after I deleted this line, the fullscreen without system bars was working fine

  • Related