danoz73 / RecyclerViewFastScroller

A Fast Scroller for the RecyclerView world!
Other
1.13k stars 211 forks source link

scroll quickly down ,indicator inaccurate #51

Open MohammadAbbasKhan opened 8 years ago

MohammadAbbasKhan commented 8 years ago

when you scroll quickly down the indicator starts to show wrong data ,

timothyjc commented 8 years ago

This was annoying me too so I investigated it. This method is returning 1 too many so it wont scroll to the last element.

 private int getPositionFromScrollProgress(float scrollProgress) {
        return (int) (mRecyclerView.getAdapter().getItemCount() * scrollProgress);
 }

And instead of mRecyclerView.scrollToPosition(position) you need to use scrollToPositionWithOffset(position, 0), on the LayoutManager.