Fast scroll for Android
RecyclerView and more.
This is not an officially supported Google product.
- Fully customizable: Override track, thumb, popup, animation and scrolling.
- Easy-to-use defaults: Predefined default style, Material Design 2 style and animation.
- Extensive view support: Out-of-box support for
WebView, plus any view with a
- Window insets friendly: Support setting a separate padding for scrollbar.
- Clean implementation: Decoupled touch handling, animation and scrolling logic.
This library is loosely based on the following AOSP implementations:
Simply create a
FastScrollerBuilder, and enjoy!
You can also implement
PopupTextProvider in your
RecyclerView.Adapter to show a popup.
For more customization, please use the methods on
setViewHelper()allows providing a custom
ViewHelperto support more views.
setPadding()allows setting a custom padding for the scrollbar, instead of the padding of the view.
setThumbDrawable()allow setting custom drawables for the scrollbar. The
android:state_pressedstate will be updated for them so you can use a selector.
setPopupStyle()allows customizing the popup view with a lambda that will receive the view.
setAnimationHelper()allows providing a custom
AnimationHelperto use an alternative scrollbar animation.
disableScrollbarAutoHide()allows disabling the auto hide animation for scrollbar. This implies using a
useMd2Style()allow using the predefined styles, which sets the drawables and popup style.
useDefaultStyle(), as its name suggests, is the default style when a
ViewHelper implementation for
RecyclerView supports both
GridLayoutManager, 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 own
ViewHelper implementation and fast scroll will work correctly again.
If you are using any
RecyclerView.ItemDecoration that implements
onDrawOver(), you might be interested in
FixItemDecorationRecyclerView which can fix the drawing order.
You can also refer to the sample app source for how things like window insets and lift on scroll are implemented.
Copyright 2019 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.