0

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);
  }
}
Ed Lee
  • 187
  • 2
  • 13
  • 1
    can you share your layout file please – Ravi Theja Sep 18 '16 at 19:31
  • Is this standard Android xml layouts or another toolkit? – Shmuel Sep 18 '16 at 19:41
  • @Shmuel standard Android views but I provide a custom xml in my NavigationView – Ed Lee Sep 18 '16 at 19:48
  • Check this out https://stackoverflow.com/questions/20781014/translucent-system-bars-and-content-margin-in-kitkat It'll probably help you – Shmuel Sep 18 '16 at 19:57
  • have to try to make your app full screen? i think you can remove this by making your app full screen. follow this link http://stackoverflow.com/questions/26543268/android-making-an-app-fullscreen – Pawanpreet Sep 19 '16 at 05:00

0 Answers0