Toolbar not collapsing with nested RecyclerView

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


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"