Set fixed height scroll thumb with RecyclerView Fast scroll enabled in android

1.7k Views Asked by At

I have implement RecyclerView fast scroll using following properties:

<android.support.v7.widget.RecyclerView
...
 app:fastScrollEnabled="true"
 app:fastScrollHorizontalThumbDrawable="@drawable/fast_scroll_thumb"
 app:fastScrollHorizontalTrackDrawable="@drawable/fast_scroll_track"
 app:fastScrollVerticalThumbDrawable="@drawable/fast_scroll_thumb"
 app:fastScrollVerticalTrackDrawable="@drawable/fast_scroll_track"/>

fast_scroll_thumb.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">
        <shape android:shape="rectangle">
            <solid android:color="@color/lightBlue" />
        </shape>
    </item>
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@color/lightBlue" />
        </shape>
    </item>
</selector>

fast_scroll_track.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/gray" />
</shape>

But, Fast scroll thumb size dependent on number of data. As a RecyclerView data increase thumb size decreased. Is there any way to fix thumb size at fixed height?

0

There are 0 best solutions below