Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawer below Toolbar with AppBarLayout #1169

Closed
Meeks91 opened this issue Apr 11, 2016 · 3 comments
Closed

Drawer below Toolbar with AppBarLayout #1169

Meeks91 opened this issue Apr 11, 2016 · 3 comments
Assignees
Labels

Comments

@Meeks91
Copy link

Meeks91 commented Apr 11, 2016

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.

@Meeks91 Meeks91 changed the title The solution you propose @https://github.com/mikepenz/MaterialDrawer/blob/develop/FAQ/howto_show_drawer_under_toolbar.md doesn't work with a RecylerView as the scrollable view in a coordinator layout The solution you propose @ https://github.com/mikepenz/MaterialDrawer/blob/develop/FAQ/howto_show_drawer_under_toolbar.md doesn't work with a RecylerView as the scrollable view in a coordinator layout Apr 11, 2016
@Meeks91 Meeks91 changed the title The solution you propose @ https://github.com/mikepenz/MaterialDrawer/blob/develop/FAQ/howto_show_drawer_under_toolbar.md doesn't work with a RecylerView as the scrollable view in a coordinator layout The solution you propose @ https://github.com/mikepenz/MaterialDrawer/blob/develop/FAQ/howto_show_drawer_under_toolbar.md doesn't work with a RecylerView as the scrollable view in a CoordinatorLayout Apr 11, 2016
@mikepenz mikepenz self-assigned this Apr 12, 2016
@mikepenz mikepenz changed the title The solution you propose @ https://github.com/mikepenz/MaterialDrawer/blob/develop/FAQ/howto_show_drawer_under_toolbar.md doesn't work with a RecylerView as the scrollable view in a CoordinatorLayout Drawer below Toolbar with AppBarLayout Apr 12, 2016
@mikepenz
Copy link
Owner

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

@mikepenz
Copy link
Owner

@Meeks91 please report back. will close for now

@plbecker
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants