Isn’t it shorter and easier to set a scroll listener on your RecyclerView, check for changes up…

I don’t think it is any shorter or easier to do that- all you really need to add for this is the CoordinatorLayout and the behavior, neither of which are particularly lengthy or complex.

The Behavior and CoordinatorLayout offer a number of advantages though. First, the Behavior is resuable, so you don’t have to create a scroll listener for every new screen that utilizes this functionality. It also works with Views other than RecyclerView, such as NestedScrollView.

Using a CoordinatorLayout also offers the opportunity to use other Behaviors with your list. If you want to use a collapsing toolbar, FAB, snackbars, or other such widgets that leverage CoordinatorLayout behaviors.

Show your support

Clapping shows how much you appreciated Bryan Herbst’s story.