Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Last active September 15, 2015 22:16
Show Gist options
  • Save mortenjust/4bbaeac14e1c09d45253 to your computer and use it in GitHub Desktop.
Save mortenjust/4bbaeac14e1c09d45253 to your computer and use it in GitHub Desktop.
disable parent touch hijacking
public static void disableTouchTheft(View view) {
view.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
view.getParent().requestDisallowInterceptTouchEvent(true); // <---
switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_UP:
view.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
return false;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment