Android: Customizing SmoothScroller for the RecyclerView

Standard

First, this is not a full comprehensive in-depth guide for the SmoothScroller, but I hope this gives you a jumpstart on where you can begin customizing because I could not find any clear tutorials on this topic.

What is a SmoothScroller you ask? A SmoothScroller is exactly as it seems. It’s a Class that helps a View scroll to an item’s position smoothly to create a seamless transition as opposed to snapping to it abruptly. In this example I will be using its child Class LinearSmoothScroller with the RecyclerView.

We all know that to initialize a RecylerView we need to set a LayoutManager like so:

mRecyclerView.setLayoutManager(mLinearLayoutManager);

or else an error will occur during run-time. Well, the LayoutManager is in charge of the smooth scrolling! Therefore, in order to customize the SmoothScroller we need to create our own custom LayoutManager first.
Continue reading