You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree with @timothyjc's suggestion, but, in my opinion, it is slightly incorrect: as far as I understand, the "offset" represents the top of visible RecyclerView content and "extent" is the bottom of it (so the size of default scrollbar represents the relative size of currently visible "window" into RecyclerView contents). This means, that accounting for scroll extent makes sense only when slider's size is influenced by it. And quick scroll thumb, that changes it's size on fly, makes for a bad quick scroller.
So in the end it should be more like:
final int thumbTop = recycler.computeVerticalScrollOffset();
final int trackLength = recycler.computeVerticalScrollRange();
if (trackLength <= 0 || thumbTop < 0 || trackLength == thumbTop) {
// the quick scroll can not be rendered at all
return -1f;
}
return scrollProgress = thumbTop / (float) trackLength;
This way the top of fixed-size thumb View would correspond exactly to the topmost visible part of RecyclerView contents.
I didn't test but couldn't this
be replaced with this?
The text was updated successfully, but these errors were encountered: