I followed this tutorial to implement the behaviors for both hiding the toolbar and the FAB when scrolled: https://mzgreen.github.io/2015/06/23/How-to-hideshow-Toolbar-when-list-is-scrolling(part3)/
I have pasted a demo of what the behavior looks like below.
Now instead of those individual items within the recyclerview in the tabs holding just a textView, I have coded it so that they hold a picture (ImageView) and below it, a recyclerview showing a list of items.
Hence, there is an outer recyclerview that contains a list of inner recyclerviews.
The inner recyclerview does not scroll - I disabled it by following the answer in this thread by overriding the method canScrollVertically(): Disable Scrolling in child Recyclerview android. I also tried enabling the scrolling for the inner recyclerview, but I experienced the same problem.
The outer recyclerview does scroll and has the behavior that shows/hides the toolbar and the FAB.
When I scroll by holding onto the picture (ImageView), the app behavior works perfectly fine, showing and hiding the toolbar and FAB. However, when I have my finger on the inner recyclerview to scroll, the outer recyclerview scrolls and the list moves up and down, but the behavior of show/hiding the toolbar and FAB is never activated.
I have a feeling that this is because the inner recyclerview had intercepted the scroll and the outer recyclerview did not get the scroll event to activate the behavior.
Does anyone know how to make sure the outer recyclerview also gets the scroll event so that the behavior works?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…