android - Detecting overscroll in NestedScrollView -
i want vertical overscroll in nestedscrollview trigger 1 of methods, displays contentloadingprogressbar while retrieving data device.
the swiperefreshlayout widget not app , there not seem way of customizing actual animation (see this question).
i have tried subclassing nestedscrollview , overriding onoverscrolled:
@override public void onoverscrolled(int scrollx, int scrolly, boolean clampedx, boolean clampedy) { super.onoverscrolled(scrollx, scrolly, clampedx, clampedy); if (clampedy && scrolly == 0) { log.d("mynestedscrollview", "top overscroll detected"); // mytopoverscrollmethod(); } else if (clampedy && scrolly > 0) { log.d("mynestedscrollview", "bottom overscroll detected"); // mybottomoverscrollmethod(); } }
however, logging messages printed 5-10 times per overscroll since gesture not instantaneous , takes while complete.
i looking way of recognizing overscroll gesture in order display contentloadingprogressbar indicate data being refreshed.
is there nice, clean way of doing this? or need deal fact onoverscrolled called multiple times?
Comments
Post a Comment