You should be able to use the parameter distanceYto determine if the view has scrolled up or down. distanceYrepresents the distance along the Y axis that has been scrolled since the last call onScroll(). If the value is distanceYgreater than zero, the view scrolls from a lower position on the Y axis to a higher position on the Y axis.
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
if (distanceY > 0) {
if (e2.getAction() = MotionEvent.ACTION_UP) {
}
}
return false;
}
Note. I have not tested if it MotionEvent.ACTION_UPdecides your need to check if the scrolling is over, but this seems practical in theory. Also note that technically this gesture can also end if the parameter is MotionEventset to MotionEvent.ACTION_CANCEL.
source
share