Materialdrawer: Drawer below Toolbar with AppBarLayout

Created on 12 Apr 2016  ·  3Comments  ·  Source: mikepenz/MaterialDrawer

Below is the XML layout from: https://github.com/mikepenz/MaterialDrawer/blob/develop/FAQ/howto_show_drawer_under_toolbar.md

<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/AppTheme.AppBarOverlay">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:popupTheme="@style/AppTheme.PopupOverlay"/>

        </android.support.design.widget.AppBarLayout>

        <FrameLayout
            android:id="@+id/drawer_layout"
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <include layout="@layout/content_main"/>

        </FrameLayout>
    </LinearLayout>

</android.support.design.widget.CoordinatorLayout>

But, if you add a RecyclerView where the tag is then the RecylerView shows on top of the AppbarLayout taking up the full screen. Or, If you put the RecyclerView above the 'drawer_layout' view, then the layout is not scrollable.

I would like to have the navigation drawer below the Toolbar, is there an alternative method other than the one you outlined ?

Thanks in advance.

question

All 3 comments

If you do not need the CoordinatorLayout you can also do it like done in this sample:
https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CustomContainerActivity.java
https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/res/layout/activity_sample_custom_container_dark_toolbar.xml

In the above your RecyclerView should be within the layout with id drawer_layout. Instead the include

@Meeks91 please report back. will close for now

Had the same issue. Your solution worked like a charm, thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oleynikd picture oleynikd  ·  4Comments

pranjal-joshi picture pranjal-joshi  ·  3Comments

GutoMartins019 picture GutoMartins019  ·  4Comments

Ahmed-Emad picture Ahmed-Emad  ·  4Comments

DasserBasyouni picture DasserBasyouni  ·  4Comments