Created
April 25, 2016 05:51
-
-
Save shem8/5bf21b24c8eca00b08daf782921e4f4a to your computer and use it in GitHub Desktop.
This file contains 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
View dismiss = findViewById(R.id.dismiss); | |
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) dismiss.getLayoutParams(); | |
SwipeDismissBehavior<View> behavior = new SwipeDismissBehavior<>(); | |
behavior.setSwipeDirection(SwipeDismissBehavior.SWIPE_DIRECTION_START_TO_END); | |
behavior.setListener(new SwipeDismissBehavior.OnDismissListener() { | |
@Override | |
public void onDismiss(final View view) { | |
finish(); | |
} | |
@Override | |
public void onDragStateChanged(int i) {} | |
}); | |
params.setBehavior(behavior); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment