# SwipeableListItem

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/listitem/SwipeableListItem.java)

*** ** * ** ***


```
public interface SwipeableListItem
```

<br />

Known direct subclasses [ListItemCardView](https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView)

|---|---|
| `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView` | A `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView` that is styled as a list item and can be swiped in a `https://developer.android.com/reference/com/google/android/material/listitem/ListItemLayout` with a sibling `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem`. |

*** ** * ** ***

Interface for the part of a ListItem that is able to be swiped.

## Summary

| ### Constants |
|---|---|
| `default static final int` | `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_CLOSED() = 3` The state at which the associated `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem` is closed and nothing is revealed. |
| `default static final int` | `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_DRAGGING() = 1` The state at which the `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem` is being dragged. |
| `default static final int` | `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_OPEN() = 4` The state at which the associated `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem` is revealed to its intrinsic width. |
| `default static final int` | `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_SETTLING() = 2` The state at which the `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem` is settling to the nearest settling point. |
| `default static final int` | `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_SWIPE_PRIMARY_ACTION() = 5` The state at which the `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem` is fully swiped, meaning the primary action has been committed. |

| ### Public methods |
|---|---|
| `abstract int` | `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#getSwipeMaxOvershoot()()` Returns the overshoot, in pixels, that the SwipeableListItem is able to be swiped past the `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_OPEN()` or `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_SWIPE_PRIMARY_ACTION()` states by, before settling. |
| `abstract boolean` | `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#isSwipeEnabled()()` Whether or not to allow the SwipeableListItem to be swiped. |
| `abstract void` | `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#onSwipe(int)(int swipeOffset)` Called when the position of the SwipeableListItem changes. |
| `abstract void` | `<T extends View & https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem> https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#onSwipeStateChanged(int,T,int)( int swipeState, T revealableListItem, int revealGravity )` Callback for when the swipe state of the SwipeableListItem changes. |
| `abstract void` | `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#setSwipeEnabled(boolean)(boolean swipeEnabled)` Sets whether or not to allow the SwipeableListItem to be swiped. |

## Constants

### STATE_CLOSED

```
default static final int STATE_CLOSED = 3
```

The state at which the associated `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem` is closed and nothing is revealed.

### STATE_DRAGGING

```
default static final int STATE_DRAGGING = 1
```

The state at which the `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem` is being dragged.

### STATE_OPEN

```
default static final int STATE_OPEN = 4
```

The state at which the associated `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem` is revealed to its intrinsic width.

### STATE_SETTLING

```
default static final int STATE_SETTLING = 2
```

The state at which the `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem` is settling to the nearest settling point.

### STATE_SWIPE_PRIMARY_ACTION

```
default static final int STATE_SWIPE_PRIMARY_ACTION = 5
```

The state at which the `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem` is fully swiped, meaning the primary action has been committed.

## Public methods

### getSwipeMaxOvershoot

```
abstract int getSwipeMaxOvershoot()
```

Returns the overshoot, in pixels, that the SwipeableListItem is able to be swiped past the `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_OPEN()` or `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_SWIPE_PRIMARY_ACTION()` states by, before settling.

### isSwipeEnabled

```
abstract boolean isSwipeEnabled()
```

Whether or not to allow the SwipeableListItem to be swiped.

### onSwipe

```
abstract void onSwipe(int swipeOffset)
```

Called when the position of the SwipeableListItem changes.

### onSwipeStateChanged

```
abstract void <T extends View & RevealableListItem> onSwipeStateChanged(
    int swipeState,
    T revealableListItem,
    int revealGravity
)
```

Callback for when the swipe state of the SwipeableListItem changes.

| Parameters |
|---|---|
| `int swipeState` | The new `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem.SwipeState` of the SwipeableListItem. |
| `T revealableListItem` | The associated `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem` that is being revealed when swiped. If the new state is `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem#STATE_CLOSED()`, this will be the last active `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem`. |
| `int revealGravity` | The `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem.RevealGravity` of the revealableListItem. |

### setSwipeEnabled

```
abstract void setSwipeEnabled(boolean swipeEnabled)
```

Sets whether or not to allow the SwipeableListItem to be swiped.