I want to implement a navigation drawer in my app and I have implement it by referring android developer's guide android developer's guide to navigation drawer. but the problem is that when I opened the app the drawer is not getting closed.it appears on top of other view's and doesn't even responds to swipes.
I have a Tab Activity which has 3 fragments and I've added the drawer layout int the tab activity's layout.
I am not getting whats the problem is? Is it because I've added tab layout and drawer in a same layout.
activity_tab.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"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout
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/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="package.name.tabs.TabActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/tb_home"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_weight="1"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:layout_scrollFlags="scroll|enterAlways"
app:title="@string/app_name">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TabItem
android:id="@+id/tab_offers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/offers_title"/>
<android.support.design.widget.TabItem
android:id="@+id/tab_products"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/products_title"/>
<android.support.design.widget.TabItem
android:id="@+id/tab_beautypersonal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/beautypersonal_title"/>
</android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_add_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:layout_marginBottom="16dp"
android:layout_marginRight="16dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:srcCompat="@android:drawable/ic_dialog_email"/>
<android.support.design.widget.NavigationView
android:id="@+id/nv_navigation_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/navigation_header"
app:menu="@menu/menu_tab"/>
</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.DrawerLayout>