I have a custom view that extends Android ScrollView. The direct child is a relative layout which has children that are clickable. I want to be able to:
- detect onScale Gesture on the scroll view (than I will manually manage the scale of the items).
- scroll the ScrollView vertically.
- keep those child items clickable.
What I have tried so far is (pseudo code):
public class CustomView extends ScrollView {
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return super.onInterceptTouchEvent(ev) || mScaleDetector.onTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return mScaleDetector.onTouchEvent(ev);
}
private class ScaleListener extends
ScaleGestureDetector.SimpleOnScaleGestureListener {
@Override
public boolean onScale(ScaleGestureDetector detector) {
// Handle the scale..
return true;
}
}
}
I also tried different configurations for the onInterceptMethod such as first call the super and the return the mScaleDetector.onTouchEvent and so on.
I succeeded to intercept the scale or the click and scroll but not both.
Thanks, Daniel