Set fixed height scroll thumb with RecyclerView Fast scroll enabled in android
Asked Answered
O

0

9

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?

Outside answered 16/7, 2018 at 12:47 Comment(1)
I did some digging on this for a different question: https://mcmap.net/q/472934/-recyclerview-fast-scroll-thumb-height-too-small-for-large-data-set ... it seems like there isn't a good answerPiezoelectricity

© 2022 - 2024 — McMap. All rights reserved.