A while ago, I released the 2.0 version of GravitySnapHelper with an extra goodie class called OrientationAwareRecyclerView.

I didn’t have the chance to properly explain the reason for that class, so I figured I would write some blog posts with some tips for nested RecyclerViews.

Problem 1

If you use a standard RecyclerView, you may encounter this behavior during scrolling:

As you can see in the video, if you try to scroll a nested RecyclerView while the parent is still settling the scroll, you won’t be able to do it easily.

Problem 2

Here’s another issue you might find:

In this case, you can’t scroll the parent RecyclerView while the nested one is still settling the scroll event.

This is even more frustrating if you have a SnapHelper attached to your RecyclerView.

Major apps like Netflix and Google Play don’t seem to have these issues, so it must be possible to improve this behavior.

The fix

To fix both of these annoying issues, OrientationAwareRecyclerView overrides onInterceptTouchEvent

When the user moves his finger, we check if the scroll direction matches the RecyclerView direction. If it does, we intercept the touch event, otherwise we don’t.

400: Invalid request

Now, if you try to reproduce the first problem, you get this:

And for the second one, you get this:

The sample from these videos is published on Github: https://github.com/rubensousa/RecyclerViewNestedExample/