# ListItemCardView

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

*** ** * ** ***


```
public class ListItemCardView extends MaterialCardView implements SwipeableListItem
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [com.google.android.material.card.MaterialCardView](https://developer.android.com/reference/com/google/android/material/card/MaterialCardView) ||
|   | ↳ | [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`.

## Summary

| ### Nested types |
|---|
| `public abstract class https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView.SwipeCallback` Callback for changes to the `https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem.SwipeState` of the ListItemCardView. |

| ### Public fields |
|---|---|
| `final int` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#swipeMaxOvershoot()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#ListItemCardView(Context)(Context context)` |
| `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#ListItemCardView(Context,AttributeSet)(Context context, AttributeSet attrs)` |
| `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#ListItemCardView(Context,AttributeSet,int)(Context context, AttributeSet attrs, int defStyleAttr)` |
| `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#ListItemCardView(Context,AttributeSet,int,int)( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes )` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#addSwipeCallback(com.google.android.material.listitem.ListItemCardView.SwipeCallback)(https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView.SwipeCallback callback)` Add a callback to be invoked when the swipe state of the SwipeableListItem changes. |
| `int` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#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. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#isSwipeEnabled()()` Whether or not to allow the SwipeableListItem to be swiped. |
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#onSwipe(int)(int swipeOffset)` Called when the position of the SwipeableListItem changes. |
| `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/ListItemCardView#onSwipeStateChanged(int,T,int)( int swipeState, T revealableListItem, int revealGravity )` Callback for when the swipe state of the SwipeableListItem changes. |
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#removeSwipeCallback(com.google.android.material.listitem.ListItemCardView.SwipeCallback)(https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView.SwipeCallback callback)` Remove the specified callback from being called when the swipe state of the SwipeableListItem changes. |
| `void` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#setSwipeEnabled(boolean)(boolean swipeEnabled)` Whether or not to enabling swiping when there is a sibling `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem`. |

| ### Protected methods |
|---|---|
| `int[]` | `https://developer.android.com/reference/com/google/android/material/listitem/ListItemCardView#onCreateDrawableState(int)(int extraSpace)` |

| ### Inherited Constants |
|---|
| From [com.google.android.material.card.MaterialCardView](https://developer.android.com/reference/com/google/android/material/card/MaterialCardView) |---|---| | `static final int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#CHECKED_ICON_GRAVITY_BOTTOM_END()` Gravity used to position the checked icon at the bottom\|end of the Card. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#CHECKED_ICON_GRAVITY_BOTTOM_START()` Gravity used to position the checked icon at the bottom\|start of the Card. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#CHECKED_ICON_GRAVITY_TOP_END()` Gravity used to position the checked icon at the top\|end of the Card. | | `static final int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#CHECKED_ICON_GRAVITY_TOP_START()` Gravity used to position the checked icon at the top\|start of the Card. | |
| From [com.google.android.material.listitem.SwipeableListItem](https://developer.android.com/reference/com/google/android/material/listitem/SwipeableListItem) |---|---| | `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. | | `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. | | `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. | | `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. | | `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. | |

| ### Inherited methods |
|---|
| From [com.google.android.material.card.MaterialCardView](https://developer.android.com/reference/com/google/android/material/card/MaterialCardView) |---|---| | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCardBackgroundColor()()` | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCardForegroundColor()()` Sets the ripple color for this card. | | `Drawable` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIcon()()` Returns this cards's checked icon. | | `int` | `@https://developer.android.com/reference/com/google/android/material/card/MaterialCardView.CheckedIconGravity https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIconGravity()()` Gets the checked icon gravity for this card | | `int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIconMargin()()` | | `int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIconSize()()` | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIconTint()()` Returns the android.content.res.ColorStateList used to tint the checked icon. | | `int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getContentPaddingBottom()()` | | `int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getContentPaddingLeft()()` | | `int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getContentPaddingRight()()` | | `int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getContentPaddingTop()()` | | `float` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getProgress()()` Returns the interpolation on the Shape Path of the card. | | `float` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getRadius()()` | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getRippleColor()()` Gets the ripple color for this card. | | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getShapeAppearanceModel()()` Due to limitations in the current implementation, if you modify the returned object call `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)` again with the modified value to propagate the required changes. | | `int` | `[getStrokeColor](https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getStrokeColor())()` **This method is deprecated.** use `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getStrokeColorStateList()` <br /> | | `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getStrokeColorStateList()()` Returns the stroke ColorStateList of this card view. | | `int` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getStrokeWidth()()` Returns the stroke width of this card view. | | `boolean` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#isCheckable()()` Returns whether this Card is checkable. | | `boolean` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#isChecked()()` | | `boolean` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#isDragged()()` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#onAttachedToWindow()()` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#onInitializeAccessibilityEvent(AccessibilityEvent)(AccessibilityEvent accessibilityEvent)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)(AccessibilityNodeInfo info)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#onMeasure(int,int)(int widthMeasureSpec, int heightMeasureSpec)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setBackground(Drawable)(Drawable drawable)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setBackgroundDrawable(Drawable)(Drawable drawable)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCardBackgroundColor(ColorStateList)(ColorStateList color)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCardBackgroundColor(int)(int color)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCardElevation(float)(float elevation)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCardForegroundColor(ColorStateList)(ColorStateList foregroundColor)` Sets the foreground color for this card. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckable(boolean)(boolean checkable)` Sets whether this Card is checkable. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setChecked(boolean)(boolean checked)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIcon(Drawable)(Drawable checkedIcon)` Sets this card's checked icon. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconGravity(int)( @https://developer.android.com/reference/com/google/android/material/card/MaterialCardView.CheckedIconGravity int checkedIconGravity )` Sets the checked icon gravity for this card | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconMargin(int)(int checkedIconMargin)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconMarginResource(int)(int checkedIconMarginResId)` Sets the margin of the checked icon using a resource id. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconResource(int)(int id)` Sets this card's checked icon using a resource id. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconSize(int)(int checkedIconSize)` Sets the size of the checked icon | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconSizeResource(int)(int checkedIconSizeResId)` Sets the size of the checked icon using a resource id. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconTint(ColorStateList)(ColorStateList checkedIconTint)` Sets this checked icon color tint using the specified android.content.res.ColorStateList. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setClickable(boolean)(boolean clickable)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setContentPadding(int,int,int,int)(int left, int top, int right, int bottom)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setDragged(boolean)(boolean dragged)` Call this when the Card is being dragged to apply the right color and elevation changes. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setMaxCardElevation(float)(float maxCardElevation)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setOnCheckedChangeListener(com.google.android.material.card.MaterialCardView.OnCheckedChangeListener)( https://developer.android.com/reference/com/google/android/material/card/MaterialCardView.OnCheckedChangeListener listener )` Register a callback to be invoked when the checked state of this Card changes. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setPreventCornerOverlap(boolean)(boolean preventCornerOverlap)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setProgress(float)(float progress)` Sets the interpolation on the Shape Path of the card. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setRadius(float)(float radius)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setRippleColor(ColorStateList)(ColorStateList rippleColor)` Sets the ripple color for this card. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setRippleColorResource(int)(int rippleColorResourceId)` Sets the ripple color resource for this card. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)(https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel shapeAppearanceModel)` Sets the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` that defines the shape. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setStrokeColor(ColorStateList)(ColorStateList strokeColor)` Sets the stroke color of this card view. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setStrokeColor(int)(int strokeColor)` Sets the stroke color of this card view. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setStrokeWidth(int)(int strokeWidth)` Sets the stroke width of this card view. | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setUseCompatPadding(boolean)(boolean useCompatPadding)` | | `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#toggle()()` | |

## Public fields

### swipeMaxOvershoot

```
public final int swipeMaxOvershoot
```

## Public constructors

### ListItemCardView

```
public ListItemCardView(Context context)
```

### ListItemCardView

```
public ListItemCardView(Context context, AttributeSet attrs)
```

### ListItemCardView

```
public ListItemCardView(Context context, AttributeSet attrs, int defStyleAttr)
```

### ListItemCardView

```
public ListItemCardView(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes
)
```

## Public methods

### addSwipeCallback

```
public void addSwipeCallback(ListItemCardView.SwipeCallback callback)
```

Add a callback to be invoked when the swipe state of the SwipeableListItem changes.

### getSwipeMaxOvershoot

```
public 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

```
public boolean isSwipeEnabled()
```

Whether or not to allow the SwipeableListItem to be swiped.

### onSwipe

```
public void onSwipe(int swipeOffset)
```

Called when the position of the SwipeableListItem changes.

### onSwipeStateChanged

```
public 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. |

### removeSwipeCallback

```
public void removeSwipeCallback(ListItemCardView.SwipeCallback callback)
```

Remove the specified callback from being called when the swipe state of the SwipeableListItem changes.

### setSwipeEnabled

```
public void setSwipeEnabled(boolean swipeEnabled)
```

Whether or not to enabling swiping when there is a sibling `https://developer.android.com/reference/com/google/android/material/listitem/RevealableListItem`.

## Protected methods

### onCreateDrawableState

```
protected int[] onCreateDrawableState(int extraSpace)
```