Reputation: 56199
I have ScrollView with width and height fill_parent and I implemented SimpleOnGestureListener like
scroller.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
gdt.onTouchEvent(event);
return true;
}
});
private class GestureListener extends SimpleOnGestureListener {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE
&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
btnNextQuestion.performClick();
return true; // Right to left
}
return false;
}
}
and at the moment it reacts only on touch from right to left when is step bigger than constant and not reacts on vertical move. What to change to ScrollView reacts ( has default behaviour on vertical move, scroll content )? Can someone help me ?
Upvotes: 0
Views: 226
Reputation: 72321
You always return true
from your onTouch()
method inside the OnTouchListener()
, and this means that you have consumed the event (do the actual scroll...), so Android will not scroll the view for you.
To let Android take care of the scroll just return false
from the onTouch()
method.
Upvotes: 1