Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timusus/RecyclerView-FastScroll
A simple FastScroller for Android's RecyclerView
https://github.com/timusus/RecyclerView-FastScroll
Last synced: 3 months ago
JSON representation
A simple FastScroller for Android's RecyclerView
- Host: GitHub
- URL: https://github.com/timusus/RecyclerView-FastScroll
- Owner: timusus
- License: other
- Created: 2016-01-13T01:35:25.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-08-13T14:12:22.000Z (about 1 year ago)
- Last Synced: 2024-06-30T16:21:54.336Z (4 months ago)
- Language: Java
- Size: 1.78 MB
- Stars: 1,382
- Watchers: 37
- Forks: 182
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-github-android-ui - RecyclerView-FastScroll - 简单的FastScroller (RecyclerView)
README
# RecyclerView-FastScroll
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.simplecityapps/recyclerview-fastscroll/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.simplecityapps/recyclerview-fastscroll) [![API](https://img.shields.io/badge/API-14%2B-blue.svg?style=flat)](https://android-arsenal.com/api?level=14)
[![License](http://img.shields.io/badge/license-APACHE2-blue.svg)](NOTICE)
[![Build Status](https://travis-ci.org/timusus/RecyclerView-FastScroll.svg?branch=master)](https://travis-ci.org/timusus/RecyclerView-FastScroll)A simple `FastScroller` for Android's `RecyclerView`.
Supports vertical `RecyclerViews` using either `LinearLayoutManager` or `GridLayoutManager` (including multiple spans).
The style is loosely based on the `ListView` `FastScroller` from whatever the last version of Lollipop was. This library borrows heavily from [Google's Launcher3 FastScroller](https://android.googlesource.com/platform/packages/apps/Launcher3/)
![Screenshot](https://github.com/timusus/RecyclerView-FastScroll/blob/master/screenshot.png)
### Gradle
`compile 'com.simplecityapps:recyclerview-fastscroll:2.0.1'`### Usage
You must use `FastScrollRecyclerView` as your base `RecyclerView`. See the sample project if you're having trouble.Via xml:
```
```
To display the `FastScrollPopup`, your adapter must implement `FastScrollRecyclerView.SectionedAdapter` and override `getSectionName()`.
If you need to know when fast-scrolling starts or stops, you can attach an OnFastScrollStateChangedListener to the FastScrollRecyclerView.
##### Varying Row Heights
By default, `FastScrollRecyclerView` assumes that all items in the adapter have the same height. If your adapter has
item views with different heights, then you should make your adapter implement the `MeasurableAdapter` interface and
override `getViewTypeHeight()` – otherwise the scroll thumb may not appear in the correct position and scrolling may
be inconsistent.`getViewTypeHeight()` returns the height of a single view of a given type in pixels. The height of each view must be
fixed and constant between all instances of a view type. Because the implementor is responsible for computing this
value before views are laid out, this is not suitable for view types where the height of a view is determined by a
variable number of lines of text that the item consumes.Currently, `MeasurableAdapter` only works with `LinearLayoutManager`. Using `MeasurableAdapter` with a
`GridLayoutManager` that has more than one span will cause the scrollbar thumb to reach the bottom of the list before
the halfway point on the scrollbar's background.##### Customisation
You can enable/disable autohide using the `fastScrollAutoHide` & `fastScrollAutoHideDelay` attributes in xml:
```
...
```Or programmatically via
- `setThumbColor(@ColorInt int color)`
- `setTrackColor(@ColorInt int color)`
- `setPopupBgColor(@ColorInt int color)`
- `setPopupTextColor(@ColorInt int color)`
- `setPopupTextSize(int size)`
- `setPopupPosition(@FastScroller.FastScrollerPopupPosition int position)`You can enable/disable fast-scrolling via:
```