Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toolbar not collapsing with nested RecyclerView

I made collapsible toolbar on Activity, but there is one problem.

Screen contains RecyclerView that has multiple layout items, and one of them is another RecyclerView that has horizontal scroll. When main recycler is scrolled, toolbar doesn't expand or collapse when scroll started on that nested recycler, but on other views it's working as it should.

To make it easier to understand: when I first touch screen on position where there is nested RecyclerView and try to scroll up and down, there is no collapsing or expanding of toolbar.

Any idea what might be causing that issue and how to fix it?

like image 791
head01 Avatar asked Nov 10 '15 08:11

head01


2 Answers

I only needed to set recyclerView.setNestedScrollingEnabled(false) for the nested RecyclerView to work.

Thanks to Reddit user in this thread: Toolbar not collapsing with nested RecyclerView

like image 193
head01 Avatar answered Oct 10 '22 09:10

head01


For those who would like the same thing in Kotlin is:

recyclerView.isNestedScrollingEnabled = false

And for XML it is this property in RecyclerView but only for API 21 and higher:

android:nestedScrollingEnabled="false"
like image 39
Xenolion Avatar answered Oct 10 '22 10:10

Xenolion