I have a Gallery composed of many ScrollViews each of which occupies the whole screen. problem is the ScrollViews\' onTouchEvent returns true and therefore prevent any other
How about this solution: Simply handle the event in both, the ScrollView and the Gallery:
public class GalleryFriendlyScrollView extends ScrollView {
private Gallery fParent;
public GalleryFriendlyScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
boolean superDone = super.onTouchEvent(ev);
// correct the location of the event because the gallery
// might have moved the scroll pane horizontally
ev.setLocation(ev.getX() + getLeft(), ev.getY());
// dispatch the event also to the gallery
boolean galleryDone = getGallery().onTouchEvent(ev);
return superDone || galleryDone;
}
private Gallery getGallery() {
if (fParent == null) {
fParent = (Gallery)this.getParent();
}
return fParent;
}
}