Fast scroll for Android RecyclerView.
- This is a Kotlin rewrite of AndroidFastScroll with better popup position.
- Fully customizable: Override track, thumb, popup, animation and scrolling.
- Easy-to-use defaults: Predefined default style, Material Design 1 style and animation.
- Better popup position: Considers adjacent items instead of first visible item, enhancing the popup position during fast scrolling for a more intuitive user experience.
- Extensive view support: Out-of-box support for
RecyclerView,ScrollView,NestedScrollViewandWebView, plus any view with aViewHelperimplementation. - Window insets friendly: Support setting a separate padding for scrollbar.
- Clean implementation: Decoupled touch handling, animation and scrolling logic.
preview.mp4
| Default style | Material Design 1 style |
|---|---|
![]() |
![]() |
- Kotlin:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
// .. other stuff ..
maven("https://jitpack.io")
}
}- Groovy:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
// .. other stuff ..
maven { url 'https://jitpack.io' }
}
}- Kotlin:
dependencies {
// .. other stuff ..
implementation("com.github.StellarSand:AndroidFastScroll-kt:v1.0.8")
}- Groovy:
dependencies {
// .. other stuff ..
implementation 'com.github.StellarSand:AndroidFastScroll-kt:v1.0.8'
}- Simply create a
FastScrolleras follows:
FastScrollerBuilder(recyclerView).build()- To show a popup, implement
PopupTextProviderin yourRecyclerView.Adapter.
class RvAdapter(
private val aListViewItems: ArrayList<RvData>
): RecyclerView.Adapter<RvAdapter.ListViewHolder>(), PopupTextProvider {
// .... other code ....
override fun getPopupText(view: View, position: Int): CharSequence {
return aListViewItems[position].title.substring(0, 1)
}
}-
For more customization, please use the methods on
FastScrollerBuilder. Namely:setViewHelper()- allows providing a customViewHelperto support more views.setPopupTextProvider()- allows providing a customPopupTextProviderif yourRecyclerView.Adaptercannot implement that interface.setPadding()- allows setting a custom padding for the scrollbar, instead of the padding of the view.setTrackDrawable()andsetThumbDrawable()- allow setting custom drawables for the scrollbar. Theandroid:state_pressedstate will be updated for them so you can use a selector. The track drawable needs to have an intrinsic width and the thumb drawable needs to have an intrinsic size, in order to allow proper touch event handling.setPopupStyle()- allows customizing the popup view with a lambda that will receive the view.setAnimationHelper()- allows providing a customAnimationHelperto use an alternative scrollbar animation.disableScrollbarAutoHide()- allows disabling the auto hide animation for scrollbar. This implies using aDefaultAnimationHelper.useDefaultStyle()anduseMd1Style()- allow using the predefined styles, which sets the drawables and popup style.useDefaultStyle(), as its name suggests, is the default style when aFastScrollerBuilderis created.
-
The default
ViewHelperimplementation forRecyclerViewsupports bothLinearLayoutManagerandGridLayoutManager, but assumes that each item has the same height when calculating scroll, as there's no common way to deal with variable item height. If you know how to measure for scrolling in your specific case, you can provide your ownViewHelperimplementation and fast scroll will work correctly again. -
If you are using any
RecyclerView.ItemDecorationthat implementsonDrawOver(), you might be interested inFixItemDecorationRecyclerViewwhich can fix the drawing order. -
If you are using any other library that makes use of
RecyclerView.OnItemTouchListener(e.g.recyclerview-selection), you might be interested inFixOnItemTouchListenerRecyclerViewwhich can correctly handle cancellations when dispatching touch events to listeners. You may also want to configure this library before others so that this library can take precedence in touch event handling.
This project is licensed under the terms of Apache v2.0 license.

