Skip to content Skip to sidebar Skip to footer

Material Design Navigation Drawer Not Sliding Out

I followed this StackOverflow post's instructions and managed to get the ActionBarDrawerToggle and its animation working. However, no navigation drawer slides out. Why is that? act

Solution 1:

I did not understand DrawerLayout, in part due to jpardogo's answer.

I needed to set the proper main content frame in my activity's XML file, so I made android.support.v4.widget.DrawerLayout the root element of the file, and put my activity's LinearLayout above the navigation drawer fragment element. Here is the proper, working code:

<android.support.v4.widget.DrawerLayoutxmlns: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:id="@+id/drawer_layout"android:layout_width="match_parent"android:layout_height="match_parent"><!-- Main layout --><LinearLayoutandroid:id="@+id/container"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity"tools:ignore="MergeRootFrame"android:fitsSystemWindows="true" ><includelayout="@layout/toolbar" /><it.neokree.materialtabs.MaterialTabHostandroid:id="@+id/materialTabHost"android:layout_width="match_parent"android:layout_height="48dp"app:textColor="#FFFFFF"app:primaryColor="#33B5E5"app:accentColor="#FFFFFF" /><android.support.v4.view.ViewPagerandroid:id="@+id/pager"android:layout_width="match_parent"android:layout_height="match_parent" /></LinearLayout><!-- Nav drawer --><fragmentandroid:id="@+id/nav_drawer"android:name="com.wsandhu.conjugation.DrawerFragment"android:layout_width="@dimen/drawer_width"android:layout_height="match_parent"android:layout_gravity="left|start" /></android.support.v4.widget.DrawerLayout>

It would help to compare this to the XML file in the original post. Hope this helps.

Post a Comment for "Material Design Navigation Drawer Not Sliding Out"