This question already has an answer here:
I want my drawer to open from the left below the tool bar. But, according to Material Design aspects that's not good. But still I want to do that.
Here I have changed my XML file.
---Relative Layout
-----Tool bar
-----Drawer
-------container
-------drawer List
here is my XML file. My app crashes when it opens. I don't know where I made a mistake and XML doesn't show any errors.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
<android.support.v4.widget.DrawerLayout
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">
<FrameLayout
android:id="@+id/container_body"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<fragment
android:id="@+id/fragment_navigation_drawer"
android:name="com.myApp.activity.FragmentDrawer"
android:layout_width="@dimen/nav_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="@layout/fragment_navigation_drawer"
tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Here is the latest solution for material design
Hope it helps
I have created New XML file main_activity_appbar and added tool bar first and in same layout file I added my Drawer Layout. and in mainAcitity.java file I changed layout of that file.
main_activity_appbar.xml
MainActivity.java
This is working fine.