Open negier opened 8 months ago
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.
You can use this code optimize your library, I recommand you put this code in onPreDraw listener inner.
Great
³j
FastScrollRecyclerView#updateThumbPosition
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.