RecyclerView-FastScroll icon indicating copy to clipboard operation
RecyclerView-FastScroll copied to clipboard

fixed Item Height obtain that would be a problem?

Open negier opened this issue 1 year ago • 4 comments

FastScrollRecyclerView#updateThumbPosition

rowCount * scrollPosState.rowHeight

Because some itemView height is not same. I like your smooth effect, but I haven't use your code. So this question only give you look.

negier avatar Mar 03 '24 10:03 negier

I find you use fixed ItemHeight to calculate AllHeight, and you use

View view = recyclerView.getChildAt(0);
linearLayoutManager.getDecoratedTop(view); 

But I find some code in internet, may be should be better:

            int range = 0;
            int temp = recyclerView.computeVerticalScrollRange();//整体的高度,注意是整体,包括在显示区域之外的 会动态变化
            if (temp > range) {
                range = temp;
            }
            int offset = recyclerView.computeVerticalScrollOffset();//已经向下滚动的距离,为0时表示已处于顶部。
            int extent = recyclerView.computeVerticalScrollExtent();//RecycleView显示区域的高度。
            float proportion = (float) (offset * 1.0 / (range - extent));//滑动比例

You can use this code optimize your library, I recommand you put this code in onPreDraw listener inner.

negier avatar Mar 04 '24 09:03 negier

You can use this code optimize your library, I recommand you put this code in onPreDraw listener inner.

Danielnajarn avatar Mar 10 '24 00:03 Danielnajarn

Great

Yulldem avatar Jul 19 '24 20:07 Yulldem

³j

Yulldem avatar Jul 19 '24 21:07 Yulldem