I am trying to make the navigation bar disappear from my app. The requirement is that I need to have the status bar and action bar. Only the navigation bar should be disappear.
I have this code in the activity class
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
window.decorView.apply {
systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
}
}
This code is making the navigation bar disappear. But when the activity window loses focus, the navigation bar is reappearing.
When activity is shown, the navigation bar is not appearing.
When activity window loses focus, the navigation bar is appearing. For eg., when an alert box appears.
Looking forward to the help.
Edit: Another example -- when application button is pressed. Native Google Play app is showing full screen whereas my app is displaying navigation bar