Last active
September 15, 2015 22:16
-
-
Save mortenjust/4bbaeac14e1c09d45253 to your computer and use it in GitHub Desktop.
disable parent touch hijacking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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