# Chip

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

*** ** * ** ***


```
public class Chip implements ChipDrawable.Delegate, Shapeable
```

<br />

*** ** * ** ***

Chips are compact elements that represent an attribute, text, entity, or action. They allow users to enter information, select a choice, filter content, or trigger an action.

The Chip widget is a thin view wrapper around the `https://developer.android.com/reference/com/google/android/material/chip/ChipDrawable`, which contains all of the layout and draw logic. The extra logic exists to support touch, mouse, keyboard, and accessibility navigation. The main chip and close icon are considered to be separate logical sub-views, and contain their own navigation behavior and state.

All attributes from `R.styleable.Chip` are supported. Do not use the `
android:background` attribute. It will be ignored because Chip manages its own background Drawable. Also do not use the `android:drawableStart` and `android:drawableEnd` attributes. They will be ignored because Chip manages its own start (`app:chipIcon`) and end (`app:closeIcon`) drawables. The basic attributes you can set are:

- android:checkable - If true, the chip can be toggled. If false, the chip acts like a button.
- android:text - Sets the text of the chip.
- `app:chipIcon` and `app:chipIconEnabled` - Sets the icon of the chip. Usually on the left.
- `app:checkedIcon` and `app:checkedIconEnabled` - Sets a custom icon to use when checked. Usually on the left.
- `app:closeIcon` and `app:closeIconEnabled` - Sets a custom icon that the user can click to close. Usually on the right.

You can register a listener on the main chip with setOnClickListener or `https://developer.android.com/reference/com/google/android/material/chip/Chip#setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener)`. You can register a listener on the close icon with `https://developer.android.com/reference/com/google/android/material/chip/Chip#setOnCloseIconClickListener(OnClickListener)`.

For proper rendering of the ancestor TextView in RTL mode, call `https://developer.android.com/reference/com/google/android/material/chip/Chip#setLayoutDirection(int)` with `View.LAYOUT_DIRECTION_LOCALE`. By default, TextView's layout rendering sets the text padding in LTR on initial rendering and it only renders correctly after the layout has been invalidated so you need to ensure that initial rendering has the correct layout.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/ChipDrawable` |   |

## Summary

| ### Public fields |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#accessibilityClassName()` |

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

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#dispatchKeyEvent(KeyEvent)(KeyEvent event)` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#ensureAccessibleTouchTarget(int)(int minTargetPx)` Extends the touch target of this chip using a InsetDrawable if chip's intrinsic width / height is smaller than the `minTargetPx`. |
| `https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getAccessibilityClassName()()` |
| `Drawable` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getBackgroundDrawable()()` |
| `Drawable` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getCheckedIcon()()` Returns this chip's checked icon. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getCheckedIconTint()()` Returns the android.content.res.ColorStateList used to tint the checked icon. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipBackgroundColor()()` Returns this chip's background color. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipCornerRadius()()` Returns this chip's corner radius. |
| `Drawable` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipDrawable()()` Returns the ChipDrawable backing this chip. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipEndPadding()()` Returns this chip's end padding. |
| `Drawable` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipIcon()()` Returns this chip's icon. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipIconSize()()` Returns this chip's icon size. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipIconTint()()` Returns the android.content.res.ColorStateList used to tint the chip icon. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipMinHeight()()` Returns this chip's minimum height. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipStartPadding()()` Returns this chip's start padding. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipStrokeColor()()` Returns this chip's stroke color. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipStrokeWidth()()` Returns this chip's stroke width. |
| `https://developer.android.com/reference/java/lang/CharSequence` | `[getChipText](https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipText())()` **This method is deprecated.** Use getText instead. <br /> |
| `Drawable` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getCloseIcon()()` Returns this chip's close icon. |
| `https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getCloseIconContentDescription()()` Returns this chip's close icon content description. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getCloseIconEndPadding()()` Returns the end padding for this chip's close icon. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getCloseIconSize()()` Returns this chip's close icon size. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getCloseIconStartPadding()()` Returns the start padding for this chip's close icon. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getCloseIconTint()()` Returns the tint color for this chip's close icon. |
| `TruncateAt` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getEllipsize()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getFocusedRect(Rect)(Rect r)` |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getFontVariationSettings()()` |
| `https://developer.android.com/reference/com/google/android/material/animation/MotionSpec` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getHideMotionSpec()()` Returns this chip's hide motion spec. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getIconEndPadding()()` Returns the end padding for this chip's icon. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getIconStartPadding()()` Returns the start padding for this chip's icon. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getRippleColor()()` Returns this chip's ripple color. |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getShapeAppearanceModel()()` Returns the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` used for the shape definition. |
| `https://developer.android.com/reference/com/google/android/material/animation/MotionSpec` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getShowMotionSpec()()` Returns this chip's show motion spec. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getTextEndPadding()()` Returns the end padding for this chip's text. |
| `float` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#getTextStartPadding()()` Returns the start padding for this chip's text. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#isCheckable()()` Returns whether this chip is checkable. |
| `boolean` | `[isCheckedIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#isCheckedIconEnabled())()` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#isCheckedIconVisible()` instead. <br /> |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#isCheckedIconVisible()()` Returns whether this chip's checked icon is visible. |
| `boolean` | `[isChipIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#isChipIconEnabled())()` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#isChipIconVisible()` instead. <br /> |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#isChipIconVisible()()` Returns whether this chip's icon is visible. |
| `boolean` | `[isCloseIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#isCloseIconEnabled())()` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#isCloseIconVisible()` instead. <br /> |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#isCloseIconVisible()()` Returns whether this chip's close icon is visible. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#onChipDrawableSizeChange()()` Handles a change in the ChipDrawable's size. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#onHoverEvent(MotionEvent)(MotionEvent event)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)(AccessibilityNodeInfo info)` |
| `PointerIcon` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#onResolvePointerIcon(MotionEvent,int)(MotionEvent event, int pointerIndex)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#onRtlPropertiesChanged(int)(int layoutDirection)` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#onTouchEvent(MotionEvent)(MotionEvent event)` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#performCloseIconClick()()` Call this chip's close icon click listener, if it is defined. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setAccessibilityClassName(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence className)` Sets this chip's accessibility class name. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setBackground(Drawable)(Drawable background)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setBackgroundColor(int)(int color)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setBackgroundDrawable(Drawable)(Drawable background)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setBackgroundResource(int)(int resid)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setBackgroundTintList(ColorStateList)(ColorStateList tint)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setBackgroundTintMode(Mode)(Mode tintMode)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckable(boolean)(boolean checkable)` Sets whether this chip is checkable. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckableResource(int)(int id)` Sets whether this chip is checkable using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChecked(boolean)(boolean checked)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIcon(Drawable)(Drawable checkedIcon)` Sets this chip's checked icon. |
| `void` | `[setCheckedIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconEnabled(boolean))(boolean checkedIconEnabled)` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconVisible(boolean)` instead. <br /> |
| `void` | `[setCheckedIconEnabledResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconEnabledResource(int))(int id)` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconVisible(int)` instead. <br /> |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconResource(int)(int id)` Sets this chip's checked icon using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconTint(ColorStateList)(ColorStateList checkedIconTint)` Sets this chip's checked icon's color tint using the specified android.content.res.ColorStateList. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconTintResource(int)(int id)` Sets this chip's checked icon's color tint using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconVisible(boolean)(boolean checkedIconVisible)` Sets whether this chip's checked icon is visible. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconVisible(int)(int id)` Sets whether this chip's checked icon is visible using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipBackgroundColor(ColorStateList)(ColorStateList chipBackgroundColor)` Sets this chip's background color. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipBackgroundColorResource(int)(int id)` Sets this chip's background color using a resource id. |
| `void` | `[setChipCornerRadius](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipCornerRadius(float))(float chipCornerRadius)` **This method is deprecated.** call `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#withCornerSize(float)` or call `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#toBuilder()` on the `https://developer.android.com/reference/com/google/android/material/chip/Chip#getShapeAppearanceModel()`, modify the shape using the builder and then call `https://developer.android.com/reference/com/google/android/material/chip/Chip#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)`. <br /> |
| `void` | `[setChipCornerRadiusResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipCornerRadiusResource(int))(int id)` **This method is deprecated.** call `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#withCornerSize(float)` or call `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#toBuilder()` on the `https://developer.android.com/reference/com/google/android/material/chip/Chip#getShapeAppearanceModel()`, modify the shape using the builder and then call `https://developer.android.com/reference/com/google/android/material/chip/Chip#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)`. <br /> |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipDrawable(com.google.android.material.chip.ChipDrawable)(https://developer.android.com/reference/com/google/android/material/chip/ChipDrawable drawable)` Sets the ChipDrawable backing this chip. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipEndPadding(float)(float chipEndPadding)` Sets this chip's end padding. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipEndPaddingResource(int)(int id)` Sets this chip's end padding using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIcon(Drawable)(Drawable chipIcon)` Sets this chip's icon. |
| `void` | `[setChipIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconEnabled(boolean))(boolean chipIconEnabled)` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconVisible(boolean)` instead. <br /> |
| `void` | `[setChipIconEnabledResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconEnabledResource(int))(int id)` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconVisible(int)` instead. <br /> |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconResource(int)(int id)` Sets this chip's icon using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconSize(float)(float chipIconSize)` Sets this chip icon's size. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconSizeResource(int)(int id)` Sets this chip icon's size using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconTint(ColorStateList)(ColorStateList chipIconTint)` Sets this chip icon's color tint using the specified android.content.res.ColorStateList. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconTintResource(int)(int id)` Sets this chip icon's color tint using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconVisible(boolean)(boolean chipIconVisible)` Sets whether this chip's icon is visible. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconVisible(int)(int id)` Sets the visibility of this chip's icon using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipMinHeight(float)(float minHeight)` Sets this chip's minimum height. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipMinHeightResource(int)(int id)` Sets this chip's minimum height using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipStartPadding(float)(float chipStartPadding)` Sets this chip's start padding. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipStartPaddingResource(int)(int id)` Sets this chip's start padding using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipStrokeColor(ColorStateList)(ColorStateList chipStrokeColor)` Sets this chip's stroke color. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipStrokeColorResource(int)(int id)` Sets this chip's stroke color using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipStrokeWidth(float)(float chipStrokeWidth)` Sets this chip's stroke width. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipStrokeWidthResource(int)(int id)` Sets this chip's stroke width using a resource id. |
| `void` | `[setChipText](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipText(java.lang.CharSequence))(https://developer.android.com/reference/java/lang/CharSequence chipText)` **This method is deprecated.** Use setText instead. <br /> |
| `void` | `[setChipTextResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipTextResource(int))(int id)` **This method is deprecated.** Use setText instead. <br /> |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIcon(Drawable)(Drawable closeIcon)` Sets this chip's close icon. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconContentDescription(java.lang.CharSequence)( https://developer.android.com/reference/java/lang/CharSequence closeIconContentDescription )` Sets the content description for this chip's close icon. |
| `void` | `[setCloseIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconEnabled(boolean))(boolean closeIconEnabled)` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconVisible(boolean)` instead. <br /> |
| `void` | `[setCloseIconEnabledResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconEnabledResource(int))(int id)` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconVisible(int)` instead. <br /> |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconEndPadding(float)(float closeIconEndPadding)` Sets the end padding for this chip's close icon. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconEndPaddingResource(int)(int id)` Sets the end padding for this chip's close icon using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconResource(int)(int id)` Sets this chip's close icon using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconSize(float)(float closeIconSize)` Sets this chip's close icon size. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconSizeResource(int)(int id)` Sets this chip's close icon size using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconStartPadding(float)(float closeIconStartPadding)` Sets the start padding for this chip's close icon. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconStartPaddingResource(int)(int id)` Sets the start padding for this chip's close icon using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconTint(ColorStateList)(ColorStateList closeIconTint)` Sets the tint color for this chip's close icon. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconTintResource(int)(int id)` Sets the tint color for this chip's close icon using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconVisible(boolean)(boolean closeIconVisible)` Sets whether this chip close icon is visible. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconVisible(int)(int id)` Sets whether this chip close icon is visible using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCompoundDrawables(Drawable,Drawable,Drawable,Drawable)( Drawable left, Drawable top, Drawable right, Drawable bottom )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCompoundDrawablesRelative(Drawable,Drawable,Drawable,Drawable)( Drawable start, Drawable top, Drawable end, Drawable bottom )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable,Drawable,Drawable,Drawable)( Drawable start, Drawable top, Drawable end, Drawable bottom )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCompoundDrawablesRelativeWithIntrinsicBounds(int,int,int,int)( int start, int top, int end, int bottom )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCompoundDrawablesWithIntrinsicBounds(Drawable,Drawable,Drawable,Drawable)( Drawable left, Drawable top, Drawable right, Drawable bottom )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCompoundDrawablesWithIntrinsicBounds(int,int,int,int)( int left, int top, int right, int bottom )` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setElevation(float)(float elevation)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setEllipsize(TruncateAt)(TruncateAt where)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setEnsureMinTouchTargetSize(boolean)(boolean flag)` Sets whether this chip should expand its bounds (if needed) to meet the minimum touch target size. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setFontVariationSettings(java.lang.String)(https://developer.android.com/reference/java/lang/String fontVariationSettings)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setGravity(int)(int gravity)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setHideMotionSpec(com.google.android.material.animation.MotionSpec)(https://developer.android.com/reference/com/google/android/material/animation/MotionSpec hideMotionSpec)` Sets this chip's hide motion spec. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setHideMotionSpecResource(int)(int id)` Sets this chip's hide motion spec using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setIconEndPadding(float)(float iconEndPadding)` Sets the end padding for this chip's icon. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setIconEndPaddingResource(int)(int id)` Sets the end padding for this chip's icon using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setIconStartPadding(float)(float iconStartPadding)` Sets this chip's icon start padding. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setIconStartPaddingResource(int)(int id)` Sets the start padding for this chip's icon using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setLayoutDirection(int)(int layoutDirection)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setLines(int)(int lines)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setMaxLines(int)(int maxLines)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setMaxWidth(int)(int maxWidth)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setMinLines(int)(int minLines)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener)(OnCheckedChangeListener listener)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setOnCloseIconClickListener(OnClickListener)(OnClickListener listener)` Register a callback to be invoked when the close icon is clicked. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setRippleColor(ColorStateList)(ColorStateList rippleColor)` Sets this chip's ripple color. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setRippleColorResource(int)(int id)` Sets this chip's ripple color using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#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/chip/Chip#setShowMotionSpec(com.google.android.material.animation.MotionSpec)(https://developer.android.com/reference/com/google/android/material/animation/MotionSpec showMotionSpec)` Sets this chip's show motion spec. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setShowMotionSpecResource(int)(int id)` Sets this chip's show motion spec using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setSingleLine(boolean)(boolean singleLine)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setText(java.lang.CharSequence,BufferType)(https://developer.android.com/reference/java/lang/CharSequence text, BufferType type)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextAppearance(int)(int resId)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextAppearance(com.google.android.material.resources.TextAppearance)(https://developer.android.com/reference/com/google/android/material/resources/TextAppearance textAppearance)` Sets this chip's text appearance. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextAppearance(Context,int)(Context context, int resId)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextAppearanceResource(int)(int id)` Sets this chip's text appearance using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextEndPadding(float)(float textEndPadding)` Sets the end padding for this chip's text. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextEndPaddingResource(int)(int id)` Sets the end padding for this chip's text using a resource id. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextSize(int,float)(int unit, float size)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextStartPadding(float)(float textStartPadding)` Sets the start padding for this chip's text. |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextStartPaddingResource(int)(int id)` Sets the start padding for this chip's text using a resource id. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#shouldEnsureMinTouchTargetSize()()` Returns whether this chip will expand its bounds (if needed) to meet the minimum touch target size. |

| ### Protected methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#dispatchHoverEvent(MotionEvent)(MotionEvent event)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#drawableStateChanged()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#onAttachedToWindow()()` |
| `int[]` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#onCreateDrawableState(int)(int extraSpace)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/chip/Chip#onFocusChanged(boolean,int,Rect)( boolean focused, int direction, Rect previouslyFocusedRect )` |

## Public fields

### accessibilityClassName

```
public CharSequence accessibilityClassName
```

## Public constructors

### Chip

```
public Chip(Context context)
```

### Chip

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

### Chip

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

## Public methods

### dispatchKeyEvent

```
public boolean dispatchKeyEvent(KeyEvent event)
```

### ensureAccessibleTouchTarget

```
public boolean ensureAccessibleTouchTarget(int minTargetPx)
```

Extends the touch target of this chip using a InsetDrawable if chip's intrinsic width / height is smaller than the `minTargetPx`.

| Parameters |
|---|---|
| `int minTargetPx` | minimum touch target size in pixel |

| Returns |
|---|---|
| `boolean` | whether the background was changed |

### getAccessibilityClassName

```
public CharSequence getAccessibilityClassName()
```

### getBackgroundDrawable

```
public Drawable getBackgroundDrawable()
```

### getCheckedIcon

```
public Drawable getCheckedIcon()
```

Returns this chip's checked icon.

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

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

### getCheckedIconTint

```
public ColorStateList getCheckedIconTint()
```

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

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

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

### getChipBackgroundColor

```
public ColorStateList getChipBackgroundColor()
```

Returns this chip's background color.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipBackgroundColor(ColorStateList)` |   |

### getChipCornerRadius

```
public float getChipCornerRadius()
```

Returns this chip's corner radius.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipCornerRadius(float)` |   |

### getChipDrawable

```
public Drawable getChipDrawable()
```

Returns the ChipDrawable backing this chip.

### getChipEndPadding

```
public float getChipEndPadding()
```

Returns this chip's end padding.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipEndPadding(float)` |   |

### getChipIcon

```
public Drawable getChipIcon()
```

Returns this chip's icon.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIcon(Drawable)` |   |

### getChipIconSize

```
public float getChipIconSize()
```

Returns this chip's icon size. If a non-positive value is set, the icon drawable's width and height (up to 24dp) will be used instead.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconSize(float)` |   |

### getChipIconTint

```
public ColorStateList getChipIconTint()
```

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

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconTint(ColorStateList)` |   |

### getChipMinHeight

```
public float getChipMinHeight()
```

Returns this chip's minimum height.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipMinHeight(float)` |   |

### getChipStartPadding

```
public float getChipStartPadding()
```

Returns this chip's start padding.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipStartPadding(float)` |   |

### getChipStrokeColor

```
public ColorStateList getChipStrokeColor()
```

Returns this chip's stroke color.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipStrokeColor(ColorStateList)` |   |

### getChipStrokeWidth

```
public float getChipStrokeWidth()
```

Returns this chip's stroke width.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipStrokeWidth(float)` |   |

### getChipText

```
public CharSequence [getChipText](https://developer.android.com/reference/com/google/android/material/chip/Chip#getChipText())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use getText instead.

Returns this chip's text.

### getCloseIcon

```
public Drawable getCloseIcon()
```

Returns this chip's close icon.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIcon(Drawable)` |   |

### getCloseIconContentDescription

```
public CharSequence getCloseIconContentDescription()
```

Returns this chip's close icon content description.

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconContentDescription(java.lang.CharSequence)` |   |

### getCloseIconEndPadding

```
public float getCloseIconEndPadding()
```

Returns the end padding for this chip's close icon.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconEndPadding(float)` |   |

### getCloseIconSize

```
public float getCloseIconSize()
```

Returns this chip's close icon size.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconSize(float)` |   |

### getCloseIconStartPadding

```
public float getCloseIconStartPadding()
```

Returns the start padding for this chip's close icon.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconStartPadding(float)` |   |

### getCloseIconTint

```
public ColorStateList getCloseIconTint()
```

Returns the tint color for this chip's close icon.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconTint(ColorStateList)` |   |

### getEllipsize

```
public TruncateAt getEllipsize()
```

### getFocusedRect

```
public void getFocusedRect(Rect r)
```

### getFontVariationSettings

```
public String getFontVariationSettings()
```

### getHideMotionSpec

```
public MotionSpec getHideMotionSpec()
```

Returns this chip's hide motion spec.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setHideMotionSpec(com.google.android.material.animation.MotionSpec)` |   |

### getIconEndPadding

```
public float getIconEndPadding()
```

Returns the end padding for this chip's icon.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setIconEndPadding(float)` |   |

### getIconStartPadding

```
public float getIconStartPadding()
```

Returns the start padding for this chip's icon.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setIconStartPadding(float)` |   |

### getRippleColor

```
public ColorStateList getRippleColor()
```

Returns this chip's ripple color.

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

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

### getShapeAppearanceModel

```
public ShapeAppearanceModel getShapeAppearanceModel()
```

Returns the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` used for the shape definition.

This `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` can be modified to change the shape.

### getShowMotionSpec

```
public MotionSpec getShowMotionSpec()
```

Returns this chip's show motion spec.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setShowMotionSpec(com.google.android.material.animation.MotionSpec)` |   |

### getTextEndPadding

```
public float getTextEndPadding()
```

Returns the end padding for this chip's text.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextEndPadding(float)` |   |

### getTextStartPadding

```
public float getTextStartPadding()
```

Returns the start padding for this chip's text.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setTextStartPadding(float)` |   |

### isCheckable

```
public boolean isCheckable()
```

Returns whether this chip is checkable.

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

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

### isCheckedIconEnabled

```
public boolean [isCheckedIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#isCheckedIconEnabled())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#isCheckedIconVisible()` instead.

### isCheckedIconVisible

```
public boolean isCheckedIconVisible()
```

Returns whether this chip's checked icon is visible.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconVisible(boolean)` |   |

### isChipIconEnabled

```
public boolean [isChipIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#isChipIconEnabled())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#isChipIconVisible()` instead.

### isChipIconVisible

```
public boolean isChipIconVisible()
```

Returns whether this chip's icon is visible.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconVisible(boolean)` |   |

### isCloseIconEnabled

```
public boolean [isCloseIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#isCloseIconEnabled())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#isCloseIconVisible()` instead.

### isCloseIconVisible

```
public boolean isCloseIconVisible()
```

Returns whether this chip's close icon is visible.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconVisible(boolean)` |   |

### onChipDrawableSizeChange

```
public void onChipDrawableSizeChange()
```

Handles a change in the ChipDrawable's size.

### onHoverEvent

```
public boolean onHoverEvent(MotionEvent event)
```

### onInitializeAccessibilityNodeInfo

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

### onResolvePointerIcon

```
public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex)
```

### onRtlPropertiesChanged

```
public void onRtlPropertiesChanged(int layoutDirection)
```

### onTouchEvent

```
public boolean onTouchEvent(MotionEvent event)
```

### performCloseIconClick

```
public boolean performCloseIconClick()
```

Call this chip's close icon click listener, if it is defined. Performs all normal actions associated with clicking: reporting accessibility event, playing a sound, etc.

| Returns |
|---|---|
| `boolean` | True there was an assigned close icon click listener that was called, false otherwise is returned. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setOnCloseIconClickListener(OnClickListener)` |   |

### setAccessibilityClassName

```
public void setAccessibilityClassName(CharSequence className)
```

Sets this chip's accessibility class name.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence className` | This chip's accessibility class name. |

### setBackground

```
public void setBackground(Drawable background)
```

### setBackgroundColor

```
public void setBackgroundColor(int color)
```

### setBackgroundDrawable

```
public void setBackgroundDrawable(Drawable background)
```

### setBackgroundResource

```
public void setBackgroundResource(int resid)
```

### setBackgroundTintList

```
public void setBackgroundTintList(ColorStateList tint)
```

### setBackgroundTintMode

```
public void setBackgroundTintMode(Mode tintMode)
```

### setCheckable

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

Sets whether this chip is checkable.

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

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

### setCheckableResource

```
public void setCheckableResource(int id)
```

Sets whether this chip is checkable using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip is checkable. |

### setChecked

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

### setCheckedIcon

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

Sets this chip's checked icon.

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

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

### setCheckedIconEnabled

```
public void [setCheckedIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconEnabled(boolean))(boolean checkedIconEnabled)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconVisible(boolean)` instead.

### setCheckedIconEnabledResource

```
public void [setCheckedIconEnabledResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconEnabledResource(int))(int id)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCheckedIconVisible(int)` instead.

### setCheckedIconResource

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

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

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

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

### setCheckedIconTint

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

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

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

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

### setCheckedIconTintResource

```
public void setCheckedIconTintResource(int id)
```

Sets this chip's checked icon's color tint using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for tinting the checked icon. |

### setCheckedIconVisible

```
public void setCheckedIconVisible(boolean checkedIconVisible)
```

Sets whether this chip's checked icon is visible.

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

| Parameters |
|---|---|
| `boolean checkedIconVisible` | This chip's checked icon visibility. |

### setCheckedIconVisible

```
public void setCheckedIconVisible(int id)
```

Sets whether this chip's checked icon is visible using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's check icon visibility. |

### setChipBackgroundColor

```
public void setChipBackgroundColor(ColorStateList chipBackgroundColor)
```

Sets this chip's background color.

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

| Parameters |
|---|---|
| `ColorStateList chipBackgroundColor` | This chip's background color. |

### setChipBackgroundColorResource

```
public void setChipBackgroundColorResource(int id)
```

Sets this chip's background color using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's background color. |

### setChipCornerRadius

```
public void [setChipCornerRadius](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipCornerRadius(float))(float chipCornerRadius)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> call `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#withCornerSize(float)` or call `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#toBuilder()` on the `https://developer.android.com/reference/com/google/android/material/chip/Chip#getShapeAppearanceModel()`, modify the shape using the builder and then call `https://developer.android.com/reference/com/google/android/material/chip/Chip#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)`.

### setChipCornerRadiusResource

```
public void [setChipCornerRadiusResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipCornerRadiusResource(int))(int id)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> call `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#withCornerSize(float)` or call `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#toBuilder()` on the `https://developer.android.com/reference/com/google/android/material/chip/Chip#getShapeAppearanceModel()`, modify the shape using the builder and then call `https://developer.android.com/reference/com/google/android/material/chip/Chip#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)`.

### setChipDrawable

```
public void setChipDrawable(ChipDrawable drawable)
```

Sets the ChipDrawable backing this chip.

### setChipEndPadding

```
public void setChipEndPadding(float chipEndPadding)
```

Sets this chip's end padding.

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

| Parameters |
|---|---|
| `float chipEndPadding` | This chip's end padding. |

### setChipEndPaddingResource

```
public void setChipEndPaddingResource(int id)
```

Sets this chip's end padding using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for this chip's end padding. |

### setChipIcon

```
public void setChipIcon(Drawable chipIcon)
```

Sets this chip's icon.

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

| Parameters |
|---|---|
| `Drawable chipIcon` | drawable of this chip's icon. |

### setChipIconEnabled

```
public void [setChipIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconEnabled(boolean))(boolean chipIconEnabled)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconVisible(boolean)` instead.

### setChipIconEnabledResource

```
public void [setChipIconEnabledResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconEnabledResource(int))(int id)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipIconVisible(int)` instead.

### setChipIconResource

```
public void setChipIconResource(int id)
```

Sets this chip's icon using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for this chip's icon. |

### setChipIconSize

```
public void setChipIconSize(float chipIconSize)
```

Sets this chip icon's size. If the value is zero or negative, the icon drawable's width and height (up to 24dp) will be used instead.

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

| Parameters |
|---|---|
| `float chipIconSize` | This chip's icon size. |

### setChipIconSizeResource

```
public void setChipIconSizeResource(int id)
```

Sets this chip icon's size using a resource id. If the value is zero or negative, the icon drawable's width and height (up to 24dp) will be used instead.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's icon size. |

### setChipIconTint

```
public void setChipIconTint(ColorStateList chipIconTint)
```

Sets this chip icon's color tint using the specified android.content.res.ColorStateList.

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

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

### setChipIconTintResource

```
public void setChipIconTintResource(int id)
```

Sets this chip icon's color tint using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for tinting the chip icon. |

### setChipIconVisible

```
public void setChipIconVisible(boolean chipIconVisible)
```

Sets whether this chip's icon is visible.

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

| Parameters |
|---|---|
| `boolean chipIconVisible` | The visibility of this chip's icon. |

### setChipIconVisible

```
public void setChipIconVisible(int id)
```

Sets the visibility of this chip's icon using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for the visibility of this chip's icon. |

### setChipMinHeight

```
public void setChipMinHeight(float minHeight)
```

Sets this chip's minimum height.

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

| Parameters |
|---|---|
| `float minHeight` | This chip's minimum height. |

### setChipMinHeightResource

```
public void setChipMinHeightResource(int id)
```

Sets this chip's minimum height using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's minimum height. |

### setChipStartPadding

```
public void setChipStartPadding(float chipStartPadding)
```

Sets this chip's start padding.

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

| Parameters |
|---|---|
| `float chipStartPadding` | This chip's start padding. |

### setChipStartPaddingResource

```
public void setChipStartPaddingResource(int id)
```

Sets this chip's start padding using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's start padding. |

### setChipStrokeColor

```
public void setChipStrokeColor(ColorStateList chipStrokeColor)
```

Sets this chip's stroke color.

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

| Parameters |
|---|---|
| `ColorStateList chipStrokeColor` | This chip's stroke color. |

### setChipStrokeColorResource

```
public void setChipStrokeColorResource(int id)
```

Sets this chip's stroke color using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's stroke color. |

### setChipStrokeWidth

```
public void setChipStrokeWidth(float chipStrokeWidth)
```

Sets this chip's stroke width.

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

| Parameters |
|---|---|
| `float chipStrokeWidth` | This chip's stroke width. |

### setChipStrokeWidthResource

```
public void setChipStrokeWidthResource(int id)
```

Sets this chip's stroke width using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's stroke width. |

### setChipText

```
public void [setChipText](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipText(java.lang.CharSequence))(CharSequence chipText)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use setText instead.

### setChipTextResource

```
public void [setChipTextResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setChipTextResource(int))(int id)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use setText instead.

### setCloseIcon

```
public void setCloseIcon(Drawable closeIcon)
```

Sets this chip's close icon.

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

| Parameters |
|---|---|
| `Drawable closeIcon` | This chip's close icon. |

### setCloseIconContentDescription

```
public void setCloseIconContentDescription(
    CharSequence closeIconContentDescription
)
```

Sets the content description for this chip's close icon.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence closeIconContentDescription` | The content description for this chip's close icon. |

### setCloseIconEnabled

```
public void [setCloseIconEnabled](https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconEnabled(boolean))(boolean closeIconEnabled)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconVisible(boolean)` instead.

### setCloseIconEnabledResource

```
public void [setCloseIconEnabledResource](https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconEnabledResource(int))(int id)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/chip/Chip#setCloseIconVisible(int)` instead.

### setCloseIconEndPadding

```
public void setCloseIconEndPadding(float closeIconEndPadding)
```

Sets the end padding for this chip's close icon.

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

| Parameters |
|---|---|
| `float closeIconEndPadding` | The end padding of this chip's close icon. |

### setCloseIconEndPaddingResource

```
public void setCloseIconEndPaddingResource(int id)
```

Sets the end padding for this chip's close icon using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for the end padding of this chip's close icon. |

### setCloseIconResource

```
public void setCloseIconResource(int id)
```

Sets this chip's close icon using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's close icon. |

### setCloseIconSize

```
public void setCloseIconSize(float closeIconSize)
```

Sets this chip's close icon size.

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

| Parameters |
|---|---|
| `float closeIconSize` | This chip's close icon size. |

### setCloseIconSizeResource

```
public void setCloseIconSizeResource(int id)
```

Sets this chip's close icon size using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's close icon size. |

### setCloseIconStartPadding

```
public void setCloseIconStartPadding(float closeIconStartPadding)
```

Sets the start padding for this chip's close icon.

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

| Parameters |
|---|---|
| `float closeIconStartPadding` | The start padding of this chip's close icon. |

### setCloseIconStartPaddingResource

```
public void setCloseIconStartPaddingResource(int id)
```

Sets the start padding for this chip's close icon using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for the start padding of this chip's close icon. |

### setCloseIconTint

```
public void setCloseIconTint(ColorStateList closeIconTint)
```

Sets the tint color for this chip's close icon.

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

| Parameters |
|---|---|
| `ColorStateList closeIconTint` | This chip's close icon tint. |

### setCloseIconTintResource

```
public void setCloseIconTintResource(int id)
```

Sets the tint color for this chip's close icon using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's close icon tint. |

### setCloseIconVisible

```
public void setCloseIconVisible(boolean closeIconVisible)
```

Sets whether this chip close icon is visible.

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

| Parameters |
|---|---|
| `boolean closeIconVisible` | This chip's close icon visibility. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#isCloseIconVisible()` |   |

### setCloseIconVisible

```
public void setCloseIconVisible(int id)
```

Sets whether this chip close icon is visible using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's close icon visibility. |

### setCompoundDrawables

```
public void setCompoundDrawables(
    Drawable left,
    Drawable top,
    Drawable right,
    Drawable bottom
)
```

### setCompoundDrawablesRelative

```
public void setCompoundDrawablesRelative(
    Drawable start,
    Drawable top,
    Drawable end,
    Drawable bottom
)
```

### setCompoundDrawablesRelativeWithIntrinsicBounds

```
public void setCompoundDrawablesRelativeWithIntrinsicBounds(
    Drawable start,
    Drawable top,
    Drawable end,
    Drawable bottom
)
```

### setCompoundDrawablesRelativeWithIntrinsicBounds

```
public void setCompoundDrawablesRelativeWithIntrinsicBounds(
    int start,
    int top,
    int end,
    int bottom
)
```

### setCompoundDrawablesWithIntrinsicBounds

```
public void setCompoundDrawablesWithIntrinsicBounds(
    Drawable left,
    Drawable top,
    Drawable right,
    Drawable bottom
)
```

### setCompoundDrawablesWithIntrinsicBounds

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

### setElevation

```
public void setElevation(float elevation)
```

### setEllipsize

```
public void setEllipsize(TruncateAt where)
```

### setEnsureMinTouchTargetSize

```
public void setEnsureMinTouchTargetSize(boolean flag)
```

Sets whether this chip should expand its bounds (if needed) to meet the minimum touch target size.

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

| Parameters |
|---|---|
| `boolean flag` | Whether this chip should meet the min touch target size. |

### setFontVariationSettings

```
public boolean setFontVariationSettings(String fontVariationSettings)
```

### setGravity

```
public void setGravity(int gravity)
```

### setHideMotionSpec

```
public void setHideMotionSpec(MotionSpec hideMotionSpec)
```

Sets this chip's hide motion spec.

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/animation/MotionSpec hideMotionSpec` | This chip's hide motion spec. |

### setHideMotionSpecResource

```
public void setHideMotionSpecResource(int id)
```

Sets this chip's hide motion spec using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's hide motion spec. |

### setIconEndPadding

```
public void setIconEndPadding(float iconEndPadding)
```

Sets the end padding for this chip's icon.

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

| Parameters |
|---|---|
| `float iconEndPadding` | The end padding of this chip's icon. |

### setIconEndPaddingResource

```
public void setIconEndPaddingResource(int id)
```

Sets the end padding for this chip's icon using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for the end padding of this chip's icon. |

### setIconStartPadding

```
public void setIconStartPadding(float iconStartPadding)
```

Sets this chip's icon start padding.

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

| Parameters |
|---|---|
| `float iconStartPadding` | The start padding of this chip's icon. |

### setIconStartPaddingResource

```
public void setIconStartPaddingResource(int id)
```

Sets the start padding for this chip's icon using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for the start padding of this chip's icon. |

### setLayoutDirection

```
public void setLayoutDirection(int layoutDirection)
```

### setLines

```
public void setLines(int lines)
```

### setMaxLines

```
public void setMaxLines(int maxLines)
```

### setMaxWidth

```
public void setMaxWidth(int maxWidth)
```

### setMinLines

```
public void setMinLines(int minLines)
```

### setOnCheckedChangeListener

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

### setOnCloseIconClickListener

```
public void setOnCloseIconClickListener(OnClickListener listener)
```

Register a callback to be invoked when the close icon is clicked.

### setRippleColor

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

Sets this chip's ripple color.

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

| Parameters |
|---|---|
| `ColorStateList rippleColor` | This chip's ripple color. |

### setRippleColorResource

```
public void setRippleColorResource(int id)
```

Sets this chip's ripple color using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's ripple color. |

### setShapeAppearanceModel

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

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

### setShowMotionSpec

```
public void setShowMotionSpec(MotionSpec showMotionSpec)
```

Sets this chip's show motion spec.

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/animation/MotionSpec showMotionSpec` | This chip's show motion spec. |

### setShowMotionSpecResource

```
public void setShowMotionSpecResource(int id)
```

Sets this chip's show motion spec using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's show motion spec. |

### setSingleLine

```
public void setSingleLine(boolean singleLine)
```

### setText

```
public void setText(CharSequence text, BufferType type)
```

### setTextAppearance

```
public void setTextAppearance(int resId)
```

### setTextAppearance

```
public void setTextAppearance(TextAppearance textAppearance)
```

Sets this chip's text appearance.

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/resources/TextAppearance textAppearance` | This chip's text appearance. |

### setTextAppearance

```
public void setTextAppearance(Context context, int resId)
```

### setTextAppearanceResource

```
public void setTextAppearanceResource(int id)
```

Sets this chip's text appearance using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id of this chip's text appearance. |

### setTextEndPadding

```
public void setTextEndPadding(float textEndPadding)
```

Sets the end padding for this chip's text.

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

| Parameters |
|---|---|
| `float textEndPadding` | The end padding of this chip's text. |

### setTextEndPaddingResource

```
public void setTextEndPaddingResource(int id)
```

Sets the end padding for this chip's text using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for the end padding of this chip's text. |

### setTextSize

```
public void setTextSize(int unit, float size)
```

### setTextStartPadding

```
public void setTextStartPadding(float textStartPadding)
```

Sets the start padding for this chip's text.

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

| Parameters |
|---|---|
| `float textStartPadding` | The start padding of this chip's text. |

### setTextStartPaddingResource

```
public void setTextStartPaddingResource(int id)
```

Sets the start padding for this chip's text using a resource id.

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

| Parameters |
|---|---|
| `int id` | The resource id for the start padding of this chip's text. |

### shouldEnsureMinTouchTargetSize

```
public boolean shouldEnsureMinTouchTargetSize()
```

Returns whether this chip will expand its bounds (if needed) to meet the minimum touch target size.

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

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/Chip#setEnsureMinTouchTargetSize(boolean)` |   |

## Protected methods

### dispatchHoverEvent

```
protected boolean dispatchHoverEvent(MotionEvent event)
```

### drawableStateChanged

```
protected void drawableStateChanged()
```

### onAttachedToWindow

```
protected void onAttachedToWindow()
```

### onCreateDrawableState

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

### onFocusChanged

```
protected void onFocusChanged(
    boolean focused,
    int direction,
    Rect previouslyFocusedRect
)
```