Skip to content

Commit 95173c6

Browse files
committed
[Feature] Add FastScrollerBuilder.disableScrollbarAutoHide().
1 parent 1fe334b commit 95173c6

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ For more customization, please use the methods on [`FastScrollerBuilder`](librar
5454
- `setTrackDrawable()` and `setThumbDrawable()` allow setting custom drawables for the scrollbar. The `android:state_pressed` state will be updated for them so you can use a selector.
5555
- `setPopupStyle()` allows customizing the popup view with a lambda that will receive the view.
5656
- `setAnimationHelper()` allows providing a custom `AnimationHelper` to use an alternative scrollbar animation.
57+
- `disableScrollbarAutoHide()` allows disabling the auto hide animation for scrollbar. This implies using a `DefaultAnimationHelper`.
5758
- `useDefaultStyle()` and `useMd2Style()` allow using the predefined styles, which sets the drawables and popup style. `useDefaultStyle()`, as its name suggests, is the default style when a `FastScrollerBuilder` is created.
5859

5960
The default `ViewHelper` implementation for `RecyclerView` supports both `LinearLayoutManager` and `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.

library/src/main/java/me/zhanghai/android/fastscroll/FastScrollerBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ public void setAnimationHelper(@Nullable FastScroller.AnimationHelper animationH
125125
mAnimationHelper = animationHelper;
126126
}
127127

128+
public void disableScrollbarAutoHide() {
129+
DefaultAnimationHelper animationHelper = new DefaultAnimationHelper(mView);
130+
animationHelper.setScrollbarAutoHideEnabled(false);
131+
mAnimationHelper = animationHelper;
132+
}
133+
128134
@NonNull
129135
public FastScroller build() {
130136
return new FastScroller(mView, getOrCreateViewHelper(), mPadding, mTrackDrawable,

0 commit comments

Comments
 (0)