3

I have adjusted my layout so that the Navigation Drawer appears underneath the toolbar:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.Toolbar android:id="@+id/detail_toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:layout_collapseMode="pin"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />


    <android.support.v4.widget.DrawerLayout
        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/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">



        <android.support.v7.widget.RecyclerView
            android:id="@+id/left_drawer"
            android:scrollbars="vertical"
            android:layout_width="240dp"
            android:layout_height="match_parent"
            android:layout_gravity="left|start"
            android:choiceMode="singleChoice"
            android:divider="@null"
            android:background="@color/colorPrimary"
            />

        <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=".JuceActivity" tools:ignore="MergeRootFrame">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/juce_view_container"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                android:orientation="horizontal" />

            <android.support.design.widget.FloatingActionButton android:id="@+id/fab"
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:layout_gravity="center_vertical|start" android:layout_margin="@dimen/fab_margin"
                android:src="@android:drawable/stat_notify_chat"
                app:layout_anchor="@+id/juce_view_container" app:layout_anchorGravity="top|end" />

        </android.support.design.widget.CoordinatorLayout>
    </android.support.v4.widget.DrawerLayout>
</LinearLayout>

However, now the drawer's Recycler View does not scroll and does not respond to click events.

Anything I've missed here?

Adamski
  • 3,585
  • 5
  • 42
  • 78

1 Answers1

9

Your RecyclerView needs to be listed last within the DrawerLayout to have the correct z-ordering. Currently, it is opening "under" the CoordinatorLayout, which is why you can't manipulate it by touch. Move it to after the CoordinatorLayout.

Mike M.
  • 38,532
  • 8
  • 99
  • 95