Reputation: 7082
I have a problem with a View
hierarchy in the app I am working on right now.
One of the screens looks like this:
<CoordinatorLayout>
<AppBarLayout>
<Toolbar/>
</AppBarLayout>
<RecyclerView>
... items, some of which are horizontal Recyclers...
</RecyclerView>
</CoordinatorLayout>
The whole idea is to have the Toolbar
parallax nicely when scrolling down the RecyclerView
content.
The whole thing works rather nicely, but there is a problem with the mentioned parallax behavior (which is done with a custom AppBarLayout.ScrollingViewBehavior
implementation).
There are two cases, depending on what item user focuses when scrolling:
Toolbar
parallaxes in and out.RecyclerView
will scroll as expected, but the parallax behavior will not fire, leaving the layout in a weird mid-state.Any idea why this is happening and how to get the correct behavior, aka the events being passed all the way up to the CoordinatorLayout
?
Upvotes: 0
Views: 799
Reputation: 535
For each of your sub-recyclerView's, you need to call
setNestedScrollingEnabled(false)
on that RecyclerView (you can do this from whatever viewholder you are using for your main recyclerview to create the sub ones). This is a currently known bug in nested scrolling. If I were to guess, I would say that it probably has something to do with the fact that nested scrolling layouts are not supposed to send nested scrolling notifiers to parents if they are scrolled in directions in which they do not have a scrolling axis, if that makes any sense.
Upvotes: 6