Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
AndroidFastScroll
https://github.com/zhanghai/androidfastscroll
Admin
Fast scroll for Android RecyclerView and more
Tokens:
1,004
Snippets:
13
Trust Score:
8.7
License:
Apache-2.0
Update:
1 year ago
Context
Chat
Benchmark
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### Customizing FastScroller Popup Style Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Provides an example of customizing the appearance of the FastScroller's popup view using setPopupStyle(). A lambda function is used to receive and modify the popup view. ```java fastScrollerBuilder.setPopupStyle(popupView -> { // Customize popupView here }); ``` -------------------------------- ### Customizing FastScroller with ViewHelper Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Example of providing a custom ViewHelper to FastScrollerBuilder for advanced view support or specific scrolling calculations. This is useful when the default implementation for LinearLayoutManager or GridLayoutManager is insufficient, especially with variable item heights. ```java fastScrollerBuilder.setViewHelper(new MyCustomViewHelper()); ``` -------------------------------- ### Initialize FastScroller for RecyclerView Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md This snippet demonstrates the basic initialization of the FastScroller for a RecyclerView using its builder pattern. It requires a RecyclerView instance as input and returns a configured FastScroller object. ```java new FastScrollerBuilder(recyclerView).build(); ``` -------------------------------- ### Using Default and MD2 Styles for FastScroller Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Illustrates the usage of predefined styles for the FastScroller, including useDefaultStyle() and useMd2Style(). These methods set default drawables and popup styles for quick configuration. ```java fastScrollerBuilder.useDefaultStyle(); fastScrollerBuilder.useMd2Style(); ``` -------------------------------- ### Enable Java 8 Support (Gradle) Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md This snippet demonstrates how to enable Java 8 bytecode compatibility in your Android project's Gradle configuration. This is a requirement for using the AndroidFastScroll library. ```gradle android { ... // For Java projects compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } // For Kotlin projects kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() } } ``` -------------------------------- ### Configuring FastScroller Animation Helper Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Demonstrates how to inject a custom AnimationHelper into the FastScroller for alternative scrollbar animations. This method is used when the default animation is not desired. ```java fastScrollerBuilder.setAnimationHelper(new MyCustomAnimationHelper()); ``` -------------------------------- ### Add AndroidFastScroll Dependency (Gradle) Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md This snippet shows how to add the AndroidFastScroll library to your Android project using Gradle. Ensure you have Java 8 support enabled in your project. ```gradle implementation 'me.zhanghai.android.fastscroll:library:1.3.0' ``` -------------------------------- ### Customizing FastScroller with PopupTextProvider Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Illustrates how to set a custom PopupTextProvider for the FastScroller, typically used when the RecyclerView.Adapter cannot directly implement the PopupTextProvider interface. This allows for custom text display in the scrollbar popup. ```java fastScrollerBuilder.setPopupTextProvider(new MyCustomPopupTextProvider()); ``` -------------------------------- ### Setting Custom Padding for FastScroller Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Demonstrates how to apply custom padding to the FastScroller's track and thumb, overriding the default padding derived from the RecyclerView. This allows for fine-grained control over the scrollbar's visual positioning. ```java fastScrollerBuilder.setPadding(16, 16, 16, 16); ``` -------------------------------- ### Handling Touch Listener Conflicts with FixOnItemTouchListenerRecyclerView Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Presents FixOnItemTouchListenerRecyclerView, a solution for conflicts arising from multiple RecyclerView.OnItemTouchListener instances, such as those used by libraries like recyclerview-selection. It ensures proper touch event dispatching and cancellation handling. ```java public class FixOnItemTouchListenerRecyclerView extends RecyclerView {} ``` -------------------------------- ### Applying Custom Drawables to FastScroller Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Shows how to set custom drawables for the FastScroller's track and thumb using setTrackDrawable() and setThumbDrawable(). The drawables need intrinsic dimensions, and the state_pressed attribute can be used for stateful selectors. ```java fastScrollerBuilder.setTrackDrawable(trackDrawable); fastScrollerBuilder.setThumbDrawable(thumbDrawable); ``` -------------------------------- ### Fixing ItemDecoration Drawing Order with FixItemDecorationRecyclerView Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Introduces FixItemDecorationRecyclerView, a custom RecyclerView designed to resolve drawing order issues when using RecyclerView.ItemDecoration that implements onDrawOver(). ```java public class FixItemDecorationRecyclerView extends RecyclerView {} ``` -------------------------------- ### Disabling Auto-Hide Animation for FastScroller Source: https://github.com/zhanghai/androidfastscroll/blob/master/README.md Shows how to disable the automatic hiding animation of the scrollbar using disableScrollbarAutoHide(). This implies the use of a DefaultAnimationHelper and keeps the scrollbar visible. ```java fastScrollerBuilder.disableScrollbarAutoHide(); ```