I\'m pretty new to Android app development, and I\'ve been playing around with swipe gestures using Android\'s SimpleOnGestureListener and a ViewFlipper. There are 3 childr
Try setting android:fillViewport="true"
in your layout xml for each of the ScrollView
s. That tells the ScrollView
to be as large as the view it's contained in.
Had the same issue. You need to intercept the touch event on the children of the ScrollView
when it's too short to have a scrollbar.
I needed to create a new class that extended ScrollView, and used this:
@Override
public boolean onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);
return gestureDetector.onTouchEvent(event);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev){
gestureDetector.onTouchEvent(ev);
super.dispatchTouchEvent(ev);
return true;
}
I have no idea why, but if I try to return anything but true in dispatchTouchEvent (the logical thing would have been to
return (gestureDetector.onTouchEvent(ev) || super.dispatchTouchEvent(ev));
if I understand properly), it doesn't work, and this does.