Android L: Fast scroll for the RecyclerView

Yuriy Yunikov picture Yuriy Yunikov · Oct 19, 2014 · Viewed 12.2k times · Source

I'm trying to use RecyclerView in my application with lots of data in it and would like to make a fast scroll for it, just like for the ListView. Approach from this answer worked for me with ListView, but does not work for the RecyclerView. Even if I set fast scroll to true in RecyclerView layout, it still does not work:

    <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler_view"
            android:scrollbars="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fastScrollEnabled="true"
            android:fastScrollAlwaysVisible="true" />

Does the RecyclerView supports the fast scroll in Android L? Can't find anything about this in documentation.

Answer

Gil Moshayof picture Gil Moshayof · Oct 19, 2014

The only thing you will find in RecyclerView is the basic implementation of the recycling logic. It is the complete polar opposite of ListView in that it offers you maximum customisability (you can achieve any unique layout you want unlike ListView), but it has almost nothing built in with it (unlike ListView which has numerous features like the fast scroll thumb).

If you want to add something like the fast scroll feature, you're going to need to develop it on your own for now.

New fastScrollEnabled boolean flag for RecyclerView. If enabled, fastScrollHorizontalThumbDrawable, fastScrollHorizontalTrackDrawable, fastScrollVerticalThumbDrawable, and fastScrollVerticalTrackDrawable must be set. Now available on Support Library 26.0.0