I've a view structure like this:
NestedScrollView
RecyclerView
I've implement pagination. Problem is, that RecyclerView
does not work as it should, because of NestedScrollView
(all items of recyclerview are binded at once). I solved this with:
@Override
public void onScrollChanged() {
int loaderItemPosition = mRecyclerView.getChildCount() - 1;
View view = mNestedScrollView.getChildAt(mNestedScrollView.getChildCount() - 1);
int diff = (view.getBottom() - (mNestedScrollView.getHeight() + mNestedScrollView.getScrollY()));
if (diff == 0) {
mNestedScrollView.scrollTo(0, 0);
load();
}
}
Problem is, if user "flicks" (scrolls fast from top to bottom) the scroll pops to bottom list (it can be scrolled to it, would be more correct way of saying). I tried to stop that with mNestedScrollView.scrollTo(0, 0);
. The idea was to stop scrolling when load();
is hit. If I scroll slowly, everything works good, but even now, the scroll seems little bit laggy.
Is there a way to stop scrolling when load();
is hit and not allow to scroll past that position (when user flicks)?