1

Abstract

Trying something similar to Google Maps layout behaviour

Detail

I'm trying to implement a BottomSheetBehavior that has a ViewGroup (any) -> ViewPager(Fragments) -> RecyclerView (Vertical) -> Multiple horizontally scrollable RecyclerView / or any scrollable view.

The horizontally scrollable child RecyclerViews are part of ItemHolders of parent RecyclerView (vertically scrollable)

<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"
    tools:context=".bottom.BottomSheetActivity">

    <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>

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

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/frame_bottom"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:behavior_hideable="false"
        app:behavior_peekHeight="240dp"
        android:background="@android:color/white"
        app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerView_bottom"
                android:layout_width="match_parent"
                android:nestedScrollingEnabled="true"
                android:layout_height="match_parent"/>

        </FrameLayout>

    </android.support.v4.widget.NestedScrollView>

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

Problem

When a user touches inside the horizontal scrollable element & tries to scroll vertically, the parent RecyclerView is not scrolling up/down.

When the user touches outside the horizontal scrollable element & tries to scroll vertically, the parent RecyclerView is WORKING as usual.

This problem happens only when using BottomSheetBehavior, without BottomSheetBehavior, it works perfectly fine.

I tried with a FrameLayout instead of a NestedScrollView, also tried directly putting ReyclerView as the BottomSheetBehavior viewgroup. It didn't work.

So, how do I pass the vertical scroll touch events from a horizontally scrollable reyclerView which is part of a viewHolder to the parent RecyclerView when using a BottomSheetBehavior?

0 Answers0