XML : Navigation drawer behind Toolbar

I am currently trying to have my navigation drawer going on top of my toolBar but I cannot figure out what's wrong in my code. I checked a lot a lot on the web already but I still can't see what I did wrong.

Here is what I got so far:

   <?xml version="1.0" encoding="utf-8"?>  <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/drawer_layout"      android:layout_width="match_parent"      android:layout_height="match_parent"      android:fitsSystemWindows="true"      >              <!-- This LinearLayout represents the contents of the screen  -->          <LinearLayout              android:layout_width="match_parent"              android:layout_height="match_parent"              android:orientation="vertical">                <!-- the Toolbar -->              <android.support.v7.widget.Toolbar                  xmlns:android="http://schemas.android.com/apk/res/android"                  xmlns:app="http://schemas.android.com/apk/res-auto"                  android:id="@+id/toolbar"                  android:layout_height="wrap_content"                  android:layout_width="match_parent"                  android:fitsSystemWindows="true"                  android:minHeight="?attr/actionBarSize"                  app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"                  android:background="?attr/colorPrimaryDark">              </android.support.v7.widget.Toolbar>                      <!-- Rest of the Content View -->                  <RelativeLayout                      xmlns:android="http://schemas.android.com/apk/res/android"                      xmlns:tools="http://schemas.android.com/tools"                      xmlns:app="http://schemas.android.com/apk/res-auto"                      android:layout_width="match_parent"                      android:layout_height="match_parent"                      android:paddingLeft="@dimen/activity_horizontal_margin"                      android:paddingRight="@dimen/activity_horizontal_margin"                      android:paddingTop="@dimen/activity_vertical_margin"                      android:paddingBottom="@dimen/activity_vertical_margin"                      app:layout_behavior="@string/appbar_scrolling_view_behavior"                      tools:showIn="@layout/activity_main"                      tools:context=".MainActivity">                      </RelativeLayout>                    <FrameLayout                  android:id="@+id/flContent"                  android:layout_width="match_parent"                  android:layout_height="match_parent" />              </LinearLayout>                <LinearLayout              android:layout_width="230dp"              android:layout_height="match_parent"              android:layout_gravity="left|start"              android:fitsSystemWindows="true">                <!-- drawer content -->                <android.support.design.widget.NavigationView                  android:id="@+id/nvView"                  android:layout_width="wrap_content"                  android:layout_height="match_parent"                  android:layout_gravity="start"                  android:background="@android:color/white"                  app:menu="@menu/drawer_menu"                  />            </LinearLayout>    </android.support.v4.widget.DrawerLayout>    

I already changed my style.xml with this to replace Actionbar with Toolbar as I saw on other post...

  <resources>        <!-- Base application theme. -->      <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">          <!-- Customize your theme here. -->          <item name="android:windowNoTitle">true</item>          <!--We will be using the toolbar so no need to show ActionBar-->          <item name="android:windowActionBar">false</item>          <!-- colorPrimary is used for the default action bar background -->          <item name="windowActionModeOverlay">true</item>            <item name="colorPrimary">@color/colorPrimary</item>          <item name="colorPrimaryDark">@color/colorPrimaryDark</item>          <item name="colorAccent">@color/colorAccent</item>      </style>      <style name="AppTheme.NoActionBar">          <item name="windowActionBar">false</item>          <item name="windowNoTitle">true</item>      </style>      <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />      <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />    </resources>    

No comments:

Post a Comment