SwipeDismissTouchListener
Source : https://github.com/romannurik/Android-SwipeToDismiss/blob/master/src/com/example/android/swipedismiss/SwipeDismissTouchListener.java
A View.OnTouchListener that makes any View dismissable when the user swipes (drags her finger) horizontally across the view.
For ListView list items that don't manage their own touch events (i.e. you're using setOnItemClickListener or an equivalent listener on ListActivity or https://github.com/romannurik/Android-SwipeToDismiss/blob/master/src/com/example/android/swipedismiss/SwipeDismissListViewTouchListener.java .
Example usage:
view.setOnTouchListener(new SwipeDismissTouchListener(
view,
null, // Optional token/cookie object
new SwipeDismissTouchListener.OnDismissCallback() {
public void onDismiss(View view, Object token) {
parent.removeView(view);
}
}));
Content copied to clipboard
This class Requires API level 12 or later due to use of android.view.ViewPropertyAnimator.
Constructors
Types
Link copied to clipboard
interface DismissCallbacks
The callback interface used by SwipeDismissTouchListener to inform its client about a successful dismissal of the view for which it was created.