I have an overlay ViewGroup that is the size of the screen which I want to use to show an effect when the user interacts with the app, but still passes the onTouch event to any
Here's what I did, building on Dori's answer I used onInterceptTouch . . .
float xPre = 0;
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if(Math.abs(xPre - event.getX()) < 40){
return false;
}
if(event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_MOVE){
xPre = event.getX();
}
return true;
}
Basically, when any important movement is made, remember where it happened, via xPre; then if that point is close enough to the next point to be say, an onClick/onTouch of the child view return false and let onTouch do it's default thing.