1

I have AppcompatActivity (appcompat-v7:25.3.1) which is in full screen mode using the below code. But the problem is that when in full screen mode and navigationview is displayed it shows these black overlay bar on top and bottom of it in Android 6.0, equal to the sizes of status bar and navigation bar. Navigation view after applying the below mentioned flags (Can't embed images for now :( )

private void hideAndroidNavigation() {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    getWindow().getDecorView().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_STICKY);
}

In Android 4.4 however the black overlay simply turns to white as you can see in this image.

I was able to remove the overlay for the status bar using following code:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

But I have no luck for the removal of the navigation bar overlay. I tried this solution https://stackoverflow.com/a/38008965/4428159, suggesting to remove View.SYSTEM_UI_FLAG_LAYOUT_STABLE but still the output was same

Is there any other way to remove these overlays or a solution specific to appcompat libraries?

Community
  • 1
  • 1
Umar Hussain
  • 3,461
  • 1
  • 16
  • 38

1 Answers1

0

Check if you have the following line fitSystemWindows=true in your layout xml and style xml, if so remove the line or set the value to false

Cheng Xu
  • 164
  • 9