SwipeDismissTouchListener

A android.view.View.OnTouchListener that makes any android.view.View dismissable when the user swipes (drags her finger) horizontally across the view.

For android.widget.ListView list items that don't manage their own touch events (i.e. you're using setOnItemClickListener or an equivalent listener on android.app.ListActivity or android.app.ListFragment, use SwipeDismissListViewTouchListener instead.

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);
            }
        }));

This class Requires API level 12 or later due to use of .

See also

SwipeDismissListViewTouchListener

Constructors

Link copied to clipboard
Constructs a new swipe-to-dismiss touch listener for the given view.

Types

Link copied to clipboard
The callback interface used by SwipeDismissTouchListener to inform its client about a successful dismissal of the view for which it was created.

Functions

Link copied to clipboard
open fun onTouch(view: View, motionEvent: MotionEvent): Boolean
Link copied to clipboard
open fun performDismiss()

Inheritors

Link copied to clipboard