I have an issue with Android Navigation Bar on devices like Nexus etc. Simply at all devices, which do not have the hardware menu button.
Let me explain the issue in more details.
I have an application where there are 3 parts. Content, ActionBar and bottom panel with a SeekBar.
ActionBar and bottom panel with a SeekBar are overlaying the content. Everytime I click on the content the ActionBar and bottom panel with a SeekBar disappear. Which works exactly the way it has to work. Here is a fragment of a code I use for hiding system UI:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE);
} else {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
actionBar.hide();
}
findViewById(R.id.read_book_bottom_bar).setVisibility(View.GONE);
In onCreate
method of my activity, I have this piece of code:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN);
}
However, when I launch the application on devices with Android Navigation Bar, there is a problem with displaying the bottom panel with a SeekBar. Simply, the Android Navigation Bar overlays the bottom panel with a SeekBar. Here is a screenshot:
But everytime I click on the content, the Android Navigation Bar disappears along with the ActionBar and the bottom panel with the SeekBar. So, the issue is, that everytime somebody would like to use the bottom panel with the SeekBar on devices like NEXUS, he/she would not be able to use it, because it's hidden under the Android Navigation Bar.
Could anybody help me with solving this issue? Thank you all in advance.
There are two ways to style the navigation bar depends on how you create it. One is using the XML style file if you create the navigation bar from XML. The other one is to change it using code.
An overlay is one of the primary surfaces for app content. Overlays are different from complications or Tiles, which are glanceable representations of app content. Overlays display more information and support richer interactivity.
From Settings, tap Display, and then tap Navigation bar. Make sure Buttons is selected, and then you can choose your desired button setup at the bottom of the screen.
Finally, I solved it with attribute fitsSystemWindows = true
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With