Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nested RecyclerView issue with AppBarLayout

My activity contains an AppBarLayout provided by the design library 23.0.1, it hides when I scroll up. I have a RecyclerView with each child item containing a RecyclerView too, basically a nested RecyclerView going on.

My issue is that when I touch on any of the inner RecyclerView's child and scroll up, the AppBar does not hide. However, if I place my finger somewhere else (not on the inner RecyclerView) and scroll, the app bar scrolls up just fine. Why is this happening? I even tried adding the appbar behavior for the inner recycler view, yet the app bar would only scroll up when I touch somewhere else and scroll.

Note: the inner recyclerview has a fixed set of items that would be visible at all times, basically, there is no scrolling within the recyclerview.

There is a similar question and a provided solution would be to intercept the touch of the inner recyclerview and pass it to the parent recycler view. But this disables the click events of the children in the inner recycler view, I do not want that.

like image 440
SergeantPeauts Avatar asked Oct 10 '15 06:10

SergeantPeauts


1 Answers

You need to set the nested scrolling flag to false for inner recycler views.

mSomeInnerRecyclerView.setNestedScrollingEnabled(false);

like image 150
Code-Warrior Avatar answered Oct 04 '22 19:10

Code-Warrior