ChipGroup

open class ChipGroup : FlowLayout

A ChipGroup is used to hold multiple Chips. By default, the chips are reflowed across multiple lines. Set the app:singleLine attribute to constrain the chips to a single horizontal line. If you do so, you'll usually want to wrap this ChipGroup in a .

ChipGroup also supports a multiple-exclusion scope for a set of chips. When you set the app:singleSelection attribute, checking one chip that belongs to a chip group unchecks any previously checked chip within the same group. The behavior mirrors that of .

When a chip is added to a chip group, its checked state will be preserved. If the chip group is in the single selection mode and there is an existing checked chip when another checked chip is added, the existing checked chip will be unchecked to maintain the single selection rule.

For more information, see the component developer guidance and design guidelines.

Inheritors

Constructors

Link copied to clipboard
constructor(context: Context)
constructor(context: Context, attrs: AttributeSet)
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int)

Types

Link copied to clipboard
Link copied to clipboard
Interface definition for a callback to be invoked when the checked chip changed in this group.
Link copied to clipboard
Interface definition for a callback which supports multiple checked IDs to be invoked when the checked chips changed in this group.

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open fun check(@IdRes id: Int)
Sets the selection to the chip whose identifier is passed in parameter.
Link copied to clipboard
open fun clearCheck()
Clears the selection.
Link copied to clipboard
When in single selection mode, returns the identifier of the selected chip in this group.
Link copied to clipboard
Returns the identifiers of the selected Chips in this group.
Link copied to clipboard
Returns whether we prevent all child chips from being deselected.
Link copied to clipboard
open fun isSingleLine(): Boolean
Returns whether this chip group is single line or reflowed multiline.
Link copied to clipboard
Returns whether this chip group only allows a single chip to be checked.
Link copied to clipboard
open fun setChipSpacing(@Dimension chipSpacing: Int)
Sets the horizontal and vertical spacing between visible chips in this group.
Link copied to clipboard
Sets the horizontal spacing between visible chips in this group.
Link copied to clipboard
Sets the horizontal and vertical spacing between visible chips in this group.
Link copied to clipboard
Sets the vertical spacing between visible chips in this group.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun setFlexWrap(flexWrap: Int)
Link copied to clipboard
Register a callback to be invoked when the checked chip changes in this group.
Link copied to clipboard
Register a callback to be invoked when the checked chip changes in this group.
Link copied to clipboard
open fun setSelectionRequired(selectionRequired: Boolean)
Sets whether we prevent all child chips from being deselected.
Link copied to clipboard
open fun setShowDividerHorizontal(dividerMode: Int)
Link copied to clipboard
open fun setShowDividerVertical(dividerMode: Int)
Link copied to clipboard
open fun setSingleLine(singleLine: Boolean)
open fun setSingleLine(@BoolRes id: Int)
Sets whether this chip group is single line, or reflowed multiline.
Link copied to clipboard
open fun setSingleSelection(singleSelection: Boolean)
Sets whether this chip group only allows a single chip to be checked.