I have a RecyclerView
using a LinearLayoutManager
with HORIZONTAL
orientation, nested inside a FrameLayout
using the BottomSheet
Behavior
.
When attempting to drag vertically across the RecyclerView
, the BottomSheet
doesn't respond to the drag event. Presumably this is because vertical scrolling is disabled for a LayoutManager
with horizontal orientation.
I've tried overriding LinearLayoutManager.canScrollVertically()
and returning true. This sort of works.. If you drag vertically in a very careful manner, the BottomSheet
will respond. As soon as any horizontal movement is involved however, the BottomSheet
stops responding to vertical drag events.
I'm not sure if overriding canScrollVertically()
is the right approach here - it certainly doesn't feel right from a UX point of view.
I've also noticed that if I use a ViewPager
rather than a RecyclerView
with a horizontally oriented LayoutManager
, the BottomSheet
responds to vertical swipe events as desired.
Is there some other method of LayoutManager
, RecyclerView
, BottomSheet Behavior
, or something else altogether that can help propagate the vertical scroll events on to the BottomSheet Behavior
?
There's an example of the problem here:
https://github.com/timusus/bottomsheet-test (Problem can be reproduced with commit #f59a7031)
Just expand the first bottom sheet.