NavigationView fistsSystemWindows with Translucent NavigationBar

375 views Asked by At

I've recently replaced my nav drawer with the new NavigationView from the design support library recently released and am running into a problem. My style has a translucent navigation which allows content to be scrolled underneath the nav bar. With the new layout and having fitsSystemWindows = true on the DrawerLayout needed to appear on top of the status bar, the navigation bar is no longer transparent, rather its the color of the theme background which can be seen here. I need it to resemble something like the newly updated Google Photos App

The style I have for the theme is:

<style name="Theme_Translucent_Main_Dark" parent="Theme.AppCompat.NoActionBar">
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowTranslucentNavigation">@bool/translucent_nav_bar</item>
    <item name="android:windowTranslucentStatus">false</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>

and the code for the layout is

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Fragment container -->
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?colorPrimary"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="?toolBarPopupTheme" />

    <include
        android:id="@+id/uploadMenu"
        layout="@layout/upload_menu"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="bottom|right"
        android:layout_marginBottom="@dimen/upload_button_margin_bottom"
        android:layout_marginRight="@dimen/upload_button_margin_right"
        android:visibility="visible" />

</FrameLayout>

<android.support.design.widget.NavigationView
    android:id="@+id/navigationView"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_profile"
    app:menu="@menu/menu_nav" />

I've tried several different approaches that I found here, but none seemed to work. I feel like this should be something simple that I am missing. Any help is greatly appreciated.

0

There are 0 answers