Skip to content

Instantly share code, notes, and snippets.

@ixiyang
Created August 4, 2014 02:30
Show Gist options
  • Save ixiyang/46b9f6945727b108cc94 to your computer and use it in GitHub Desktop.
Save ixiyang/46b9f6945727b108cc94 to your computer and use it in GitHub Desktop.
protected void cancelContentTouch() {
final long now = SystemClock.uptimeMillis();
final MotionEvent cancelEvent = MotionEvent.obtain(now, now, MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0);
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
getChildAt(i).dispatchTouchEvent(cancelEvent);
}
mContentContainer.dispatchTouchEvent(cancelEvent);
cancelEvent.recycle();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment