Skip to content

Instantly share code, notes, and snippets.

@shem8
Created April 25, 2016 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shem8/0d59e089f5bce63028d1ba92c5767582 to your computer and use it in GitHub Desktop.
Save shem8/0d59e089f5bce63028d1ba92c5767582 to your computer and use it in GitHub Desktop.
public class SwipeDismissOnlyOnViewBehavior<V extends View> extends SwipeDismissBehavior<V> {
/**
* Handle only touches on this current view
*/
@Override
public boolean onTouchEvent(CoordinatorLayout parent, V child, MotionEvent event) {
if (parent.isPointInChildBounds(child, (int) event.getX(), (int) event.getY())) {
return super.onTouchEvent(parent, child, event);
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment