I need to implement Fast scrolling in my recycler view.
What is the proper way of creating a Fast Scroller for a RecyclerView?
Should I do it in the LayoutManager? With an ItemDecorator?
I saw there are a few libraries and code examples.+Mark Allison
address this with:https://blog.stylingandroid.com/recyclerview-fastscroll-part-1/https://blog.stylingandroid.com/recyclerview-fastscroll-part-2/
However I don't like the fact that this has to create an external layout positioned and sized separately from your RecyclerView (if you use the new design library with the Coordinator Layout and AppBarLayout behavior for example you end up having some issue in implementing the sizing correctly.
I need the fast scroll to be highly customizable, to stay hidden normally and just pop up with an animation if the user scroll near the border like the old ListView did. Smooth animations to show the "bubble" and so on.
Furthermore I'd like to go down to Android SDK 9 (but I can relax this limit by just providing FastScroll to more-recent-device users).
For now I can accept the LinearLayoutManager only limitation.
I've looked into the code by +Mark Allison
and even implemented it in the app I'm working, starting from the code I found here:https://github.com/AndroidDeveloperLB/LollipopContactsRecyclerViewFastScroller
Aside from the separate layout issue it has these problems:
- the scroll handle is always visible, even if you are not scrolling (doesn't stay small and gets bigger while scrolling)
- it doesn't smoothly scrolls, instead it jumps from position to position while you scroll your items up and down
- the bubble flickers while scrolling
I think most of these issues may be fixable by customizing the code but before jumping into development (since this is not YET urgent in my project) I'd like to explore others possible ways of implementing it.
The only library I could find is this by Daniel Smith:https://github.com/danoz73/RecyclerViewFastScroller
this has minSDK 14 and my project has 9, gradle/android studio complains and does not allow me to set the library as dependency (even if I wanted to use it selectively for SDK 14 and up), bug?
regardless of that I gave it a try too.
It's lot smoother and a bit more convoluted to integrate but works.
However it has the same problem of having to correctly position the other layout.
It has an always visible vertical line and handle. It position the buble in such a way that you cover it partly with your finger while scrolling.
I'm still not convinced that having external views for this stuff is the best way to implement a fast scroller, but I've not much experience with Recycler View.
How would you implement a fast scroller for RecyclerView? Why? #AndroidDev #RecyclerView
(sorry for the long post)