6

I'm currently working on something where I want the status and navigation bars to be transparent, with the content going behind them. Currently, I have the bars set to @android:color/transparent in styles.xml and am able to get the content behind the status bar with this code:

getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
                   View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            );

However I am still struggling to get it behind the nav bar. Any help appreciated.

Thanks, Josh

Joshua Feltimo
  • 323
  • 1
  • 3
  • 12

2 Answers2

14

You need:

getWindow()
  .setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

Check out the answer here:

Showing content behind status and navigation bar

droid256
  • 404
  • 5
  • 15
10

Try to add these in your activity's style.xml:

<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:fitsSystemWindows">true</item>

hope this can help.

L. Swifter
  • 3,179
  • 28
  • 52