# MaterialCardView

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

*** ** * ** ***


```
public class MaterialCardView implements Shapeable
```

<br />

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

|---|---|
| `https://developer.android.com/reference/com/google/android/material/circularreveal/cardview/CircularRevealCardView` | A CircularRevealWidget wrapper for `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView`. |
| `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`. |

Known indirect subclasses [TransformationChildCard](https://developer.android.com/reference/com/google/android/material/transformation/TransformationChildCard)

|---|---|
| `https://developer.android.com/reference/com/google/android/material/transformation/TransformationChildCard` | **This class is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/transition/MaterialContainerTransform` instead. <br /> |

*** ** * ** ***

Provides a Material card.

This class supplies Material styles for the card in the constructor. The widget will display the correct default Material styles without the use of a style flag.

Stroke width can be set using the `strokeWidth` attribute. Set the stroke color using the `strokeColor` attribute. Without a `strokeColor`, the card will not render a stroked border, regardless of the `strokeWidth` value.

Cards implement Checkable, a default way to switch to `android:checked_state` is not provided. Clients have to call `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setChecked(boolean)`. This shows the `
app:checkedIcon` and changes the overlay color.

Cards also have a custom state meant to be used when a card is draggable `
app:dragged_state`. It's used by calling `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setDragged(boolean)`. This changes the overlay color and elevates the card to convey motion.

**Note:** The actual view hierarchy present under MaterialCardView is **NOT** guaranteed to match the view hierarchy as written in XML. As a result, calls to getParent() on children of the MaterialCardView, will not return the MaterialCardView itself, but rather an intermediate View. If you need to access a MaterialCardView directly, set an `
android:id` and use findViewById.

For more information, see the [component developer guidance](https://github.com/material-components/material-components-android/blob/master/docs/components/Card.md) and [design guidelines](https://material.io/components/cards/overview).

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Retention(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.SOURCE) public annotation https://developer.android.com/reference/com/google/android/material/card/MaterialCardView.CheckedIconGravity` Positions the icon can be set to. |
| `public interface https://developer.android.com/reference/com/google/android/material/card/MaterialCardView.OnCheckedChangeListener` Interface definition for a callback to be invoked when the card checked state changes. |

| ### Constants |
|---|---|
| `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. |

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

| ### Public methods |
|---|---|
| `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#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#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()()` |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#onAttachedToWindow()()` |
| `int[]` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#onCreateDrawableState(int)(int extraSpace)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#onMeasure(int,int)(int widthMeasureSpec, int heightMeasureSpec)` |

## Constants

### CHECKED_ICON_GRAVITY_BOTTOM_END

```
public static final int CHECKED_ICON_GRAVITY_BOTTOM_END
```

Gravity used to position the checked icon at the bottom\|end of the Card.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconGravity(int)` |   |
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIconGravity()` |   |

### CHECKED_ICON_GRAVITY_BOTTOM_START

```
public static final int CHECKED_ICON_GRAVITY_BOTTOM_START
```

Gravity used to position the checked icon at the bottom\|start of the Card.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconGravity(int)` |   |
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIconGravity()` |   |

### CHECKED_ICON_GRAVITY_TOP_END

```
public static final int CHECKED_ICON_GRAVITY_TOP_END
```

Gravity used to position the checked icon at the top\|end of the Card.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconGravity(int)` |   |
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIconGravity()` |   |

### CHECKED_ICON_GRAVITY_TOP_START

```
public static final int CHECKED_ICON_GRAVITY_TOP_START
```

Gravity used to position the checked icon at the top\|start of the Card.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconGravity(int)` |   |
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIconGravity()` |   |

## Public constructors

### MaterialCardView

```
public MaterialCardView(Context context)
```

### MaterialCardView

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

### MaterialCardView

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

## Public methods

### getCardBackgroundColor

```
public ColorStateList getCardBackgroundColor()
```

### getCardForegroundColor

```
public ColorStateList getCardForegroundColor()
```

Sets the ripple color for this card.

ref com.google.android.material.R.styleable#MaterialCardView_cardForegroundColor

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCardForegroundColor(ColorStateList)` |   |

### getCheckedIcon

```
public Drawable getCheckedIcon()
```

Returns this cards's checked icon.

ref com.google.android.material.R.styleable#MaterialCardView_checkedIcon

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIcon(Drawable)` |   |

### getCheckedIconGravity

```
@MaterialCardView.CheckedIconGravity
public int getCheckedIconGravity()
```

Gets the checked icon gravity for this card

ref com.google.android.material.R.styleable#MaterialCard_checkedIconGravity

| Returns |
|---|---|
| `int` | Checked Icon gravity of the card. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconGravity(int)` |   |

### getCheckedIconMargin

```
public int getCheckedIconMargin()
```

### getCheckedIconSize

```
public int getCheckedIconSize()
```

### getCheckedIconTint

```
public ColorStateList getCheckedIconTint()
```

Returns the android.content.res.ColorStateList used to tint the checked icon.

ref com.google.android.material.R.styleable#MaterialCardView_checkedIconTint

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckedIconTint(ColorStateList)` |   |

### getContentPaddingBottom

```
public int getContentPaddingBottom()
```

### getContentPaddingLeft

```
public int getContentPaddingLeft()
```

### getContentPaddingRight

```
public int getContentPaddingRight()
```

### getContentPaddingTop

```
public int getContentPaddingTop()
```

### getProgress

```
public float getProgress()
```

Returns the interpolation on the Shape Path of the card.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getInterpolation()` |   |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` |   |

### getRadius

```
public float getRadius()
```

### getRippleColor

```
public ColorStateList getRippleColor()
```

Gets the ripple color for this card.

ref com.google.android.material.R.styleable#MaterialCardView_rippleColor

| Returns |
|---|---|
| `ColorStateList` | The color used for the ripple. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setRippleColor(ColorStateList)` |   |
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setRippleColorResource(int)` |   |

### getShapeAppearanceModel

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

### getStrokeColor

```
public int [getStrokeColor](https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getStrokeColor())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getStrokeColorStateList()`

### getStrokeColorStateList

```
public ColorStateList getStrokeColorStateList()
```

Returns the stroke ColorStateList of this card view.

### getStrokeWidth

```
public int getStrokeWidth()
```

Returns the stroke width of this card view.

### isCheckable

```
public boolean isCheckable()
```

Returns whether this Card is checkable.

ref com.google.android.material.R.styleable#MaterialCardView_android_checkable

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setCheckable(boolean)` |   |

### isChecked

```
public boolean isChecked()
```

### isDragged

```
public boolean isDragged()
```

### onInitializeAccessibilityEvent

```
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent)
```

### onInitializeAccessibilityNodeInfo

```
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
```

### setBackground

```
public void setBackground(Drawable drawable)
```

### setBackgroundDrawable

```
public void setBackgroundDrawable(Drawable drawable)
```

### setCardBackgroundColor

```
public void setCardBackgroundColor(ColorStateList color)
```

### setCardBackgroundColor

```
public void setCardBackgroundColor(int color)
```

### setCardElevation

```
public void setCardElevation(float elevation)
```

### setCardForegroundColor

```
public void setCardForegroundColor(ColorStateList foregroundColor)
```

Sets the foreground color for this card.

ref com.google.android.material.R.styleable#MaterialCardView_cardForegroundColor

| Parameters |
|---|---|
| `ColorStateList foregroundColor` | Color to use for the foreground. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCardForegroundColor()` |   |

### setCheckable

```
public void setCheckable(boolean checkable)
```

Sets whether this Card is checkable.

ref com.google.android.material.R.styleable#MaterialCardView_android_checkable

| Parameters |
|---|---|
| `boolean checkable` | Whether this chip is checkable. |

### setChecked

```
public void setChecked(boolean checked)
```

### setCheckedIcon

```
public void setCheckedIcon(Drawable checkedIcon)
```

Sets this card's checked icon.

ref com.google.android.material.R.styleable#MaterialCardView_checkedIcon

| Parameters |
|---|---|
| `Drawable checkedIcon` | This card's checked icon. |

### setCheckedIconGravity

```
public void setCheckedIconGravity(
    @MaterialCardView.CheckedIconGravity int checkedIconGravity
)
```

Sets the checked icon gravity for this card

ref com.google.android.material.R.styleable#MaterialCard_checkedIconGravity

| Parameters |
|---|---|
| `@https://developer.android.com/reference/com/google/android/material/card/MaterialCardView.CheckedIconGravity int checkedIconGravity` | checked icon gravity for this card |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getCheckedIconGravity()` |   |

### setCheckedIconMargin

```
public void setCheckedIconMargin(int checkedIconMargin)
```

### setCheckedIconMarginResource

```
public void setCheckedIconMarginResource(int checkedIconMarginResId)
```

Sets the margin of the checked icon using a resource id.

ref com.google.android.material.R.styleable#MaterialCardView_checkedIconMargin

| Parameters |
|---|---|
| `int checkedIconMarginResId` | The resource id of this Card's checked icon margin |

### setCheckedIconResource

```
public void setCheckedIconResource(int id)
```

Sets this card's checked icon using a resource id.

ref com.google.android.material.R.styleable#MaterialCardView_checkedIcon

| Parameters |
|---|---|
| `int id` | The resource id of this Card's checked icon. |

### setCheckedIconSize

```
public void setCheckedIconSize(int checkedIconSize)
```

Sets the size of the checked icon

ref com.google.android.material.R.styleable#MaterialCardView_checkedIconSize

| Parameters |
|---|---|
| `int checkedIconSize` | checked icon size |

### setCheckedIconSizeResource

```
public void setCheckedIconSizeResource(int checkedIconSizeResId)
```

Sets the size of the checked icon using a resource id.

ref com.google.android.material.R.styleable#MaterialCardView_checkedIconSize

| Parameters |
|---|---|
| `int checkedIconSizeResId` | The resource id of this Card's checked icon size |

### setCheckedIconTint

```
public void setCheckedIconTint(ColorStateList checkedIconTint)
```

Sets this checked icon color tint using the specified android.content.res.ColorStateList.

ref com.google.android.material.R.styleable#MaterialCardView_checkedIconTint

| Parameters |
|---|---|
| `ColorStateList checkedIconTint` | The tint color of this chip's icon. |

### setClickable

```
public void setClickable(boolean clickable)
```

### setContentPadding

```
public void setContentPadding(int left, int top, int right, int bottom)
```

### setDragged

```
public void setDragged(boolean dragged)
```

Call this when the Card is being dragged to apply the right color and elevation changes.

| Parameters |
|---|---|
| `boolean dragged` | whether the card is currently being dragged or at rest. |

### setMaxCardElevation

```
public void setMaxCardElevation(float maxCardElevation)
```

### setOnCheckedChangeListener

```
public void setOnCheckedChangeListener(
    MaterialCardView.OnCheckedChangeListener listener
)
```

Register a callback to be invoked when the checked state of this Card changes.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView.OnCheckedChangeListener listener` | the callback to call on checked state change |

### setPreventCornerOverlap

```
public void setPreventCornerOverlap(boolean preventCornerOverlap)
```

### setProgress

```
public void setProgress(float progress)
```

Sets the interpolation on the Shape Path of the card. Useful for animations.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setInterpolation(float)` |   |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` |   |

### setRadius

```
public void setRadius(float radius)
```

### setRippleColor

```
public void setRippleColor(ColorStateList rippleColor)
```

Sets the ripple color for this card.

ref com.google.android.material.R.styleable#MaterialCardView_rippleColor

| Parameters |
|---|---|
| `ColorStateList rippleColor` | Color to use for the ripple. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setRippleColorResource(int)` |   |
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getRippleColor()` |   |

### setRippleColorResource

```
public void setRippleColorResource(int rippleColorResourceId)
```

Sets the ripple color resource for this card.

ref com.google.android.material.R.styleable#MaterialCardView_rippleColor

| Parameters |
|---|---|
| `int rippleColorResourceId` | Color resource to use for the ripple. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#setRippleColor(ColorStateList)` |   |
| `https://developer.android.com/reference/com/google/android/material/card/MaterialCardView#getRippleColor()` |   |

### setShapeAppearanceModel

```
public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel)
```

Sets the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` that defines the shape.

### setStrokeColor

```
public void setStrokeColor(ColorStateList strokeColor)
```

Sets the stroke color of this card view.

| Parameters |
|---|---|
| `ColorStateList strokeColor` | The ColorStateList of the stroke. |

### setStrokeColor

```
public void setStrokeColor(int strokeColor)
```

Sets the stroke color of this card view.

| Parameters |
|---|---|
| `int strokeColor` | The color of the stroke. |

### setStrokeWidth

```
public void setStrokeWidth(int strokeWidth)
```

Sets the stroke width of this card view.

| Parameters |
|---|---|
| `int strokeWidth` | The width in pixels of the stroke. |

### setUseCompatPadding

```
public void setUseCompatPadding(boolean useCompatPadding)
```

### toggle

```
public void toggle()
```

## Protected methods

### onAttachedToWindow

```
protected void onAttachedToWindow()
```

### onCreateDrawableState

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

### onMeasure

```
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
```