I implemented Immersive Mode and have no problems with that in my Activity except for the NavigationView/DrawerLayout portion of my Android app.
How do I get rid of these bars - I've tried messing around with windowTranslucentBar, fitsSystemWindows but haven't been able to get rid of it.
edit: the relevant parts of my xml layouts
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:openDrawer="start">
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="340dp"
android:layout_height="match_parent"
android:background="@color/backgroundColorPrimary"
android:layout_gravity="start"
app:headerLayout="@layout/nav_header_main"
app:itemBackground="@color/backgroundColorPrimary"
app:itemIconTint="@color/foregroundColorPrimary"
app:itemTextColor="@color/foregroundColorPrimary">
<include layout="@layout/nav_side_bar"/>
</android.support.design.widget.NavigationView>
edit: how I'm enabling Immersive mode
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
mDecorView.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);
}
}