我已经使用以下属性实现了RecyclerView快速滚动:
<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>
但是,快速滚动拇指大小取决于数据数量。随着RecyclerView数据的增加,拇指大小减小。有什么方法可以将拇指大小固定在固定高度上吗?