Reputation: 319
I know this question has been asked before but it seems like in the newer versions of AndroidStudio something has changed. Eitehrways, the old solutions don't seem to work or I am doing something wrong.
XML:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_homescreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:menu="@menu/activity_homescreen_drawer" />
</android.support.v4.widget.DrawerLayout>
Upvotes: 1
Views: 754
Reputation: 76564
Your DrawerLayout
is above the App Bar in the layout, therefore it draws over it.
You need to do something like:
<FrameLayout
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"
...
>
<include
layout="@layout/app_bar_homescreen"
...
/>
<android.support.v4.widget.DrawerLayout
...>
... rest of your XML layout
</DrawerLayout>
</FrameLayout>
This will allow the App Bar
to be drawn "on top" of the nav drawer
Upvotes: 2