Android: How to force navigation bar to be visible on Samsung Galaxy S8

Dambakk picture Dambakk · Jul 3, 2017 · Viewed 7k times · Source

Is is possible to force an app to always show to navigation bar in an Android app? On Samsung Galaxy S8 it is possible for the user to hide the navbar during "runtime" - which cause some unexpected behaviours in the app (if you are interested; I tried to add a setOnSystemUiVisibilityChangeListener and redraw, invalidate, requestLayout and forceLayout on the view with no luck. Restarting the activity is not applicable as the app is a single-activity-app. I've also looked into WindowInsets with no luck there neither.).

Therefor, I just want to avoid the problem by not allowing the user to remove the navbar. All the resources I can find online is for hiding the navbar. Does anybody how any suggestions on how to make it stay?

Answer

Detoxic Spirit picture Detoxic Spirit · Jun 15, 2018

I am not much sure about Samsung S8, but I had worked on Samsung S7. I had used lean back mode setSystemUiVisibility() and passed these two flags

1.SYSTEM_UI_FLAG_FULLSCREEN
2.SYSTEM_UI_FLAG_HIDE_NAVIGATION
Also for enabling immersive mode, I had used SYSTEM_UI_FLAG_IMMERSIVE in conjunction.

It was referenced from visibility & immersive.

Correct me if I am wrong or I didn't understand the question.