0

Is there a possibility to keep the scroll-bar of a fast-scrolling recyclerview from fading? Right now I have this recyclerview:

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/result_list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fadeScrollbars="false"
    app:fastScrollEnabled="true"
    app:fastScrollHorizontalThumbDrawable="@drawable/thumb_drawable"
    app:fastScrollHorizontalTrackDrawable="@drawable/line_drawable"
    app:fastScrollVerticalThumbDrawable="@drawable/thumb_drawable"
    app:fastScrollVerticalTrackDrawable="@drawable/line_drawable"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />

When I was still using a normal scrollbar, fadeScrollbars = false, did work, but the fast-scroll bar doesn't seem to care about this attribute at all. Is there a possibility to keep it there continuosly and prevent it from fading as soon as the user stops scrolling?

  • 1
    I've read through source of [`FastScroller`](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/FastScroller.java) and I don't see any room for customization there, if you really need it you'd probably need to copy it, rip out the fade in/out behavior then attach it from within your code instead of native one. – Pawel Jan 28 '22 at 16:43
  • Alright. Feared so, but I guess that's the only way so far. – Sarah Multitasker Jan 29 '22 at 18:44

1 Answers1

0

As of now the best way is to use android:fadeScrollbars="false" in xml which is equivalent to ScrollView.setScrollbarFadingEnabled(false); in java code.

Omkar T
  • 755
  • 8
  • 19