CompactChip

Added in 1.1.0
Deprecated in 1.2.0

class CompactChip : LayoutElementBuilders.LayoutElement


Tiles component CompactChip that represents clickable object with the text.

The Chip is Stadium shape and has a max height designed to take no more than one line of text of TYPOGRAPHY_CAPTION1 style. Width of the chip is adjustable to the text size.

The recommended set of ChipColors styles can be obtained from ChipDefaults., e.g. COMPACT_PRIMARY_COLORS to get a color scheme for a primary .

When accessing the contents of a container for testing, note that this element can't be simply casted back to the original type, i.e.:

CompactChip chip = new CompactChip...
Box box = new Box.Builder().addContent(chip).build();

CompactChip myChip = (CompactChip) box.getContents().get(0);
will fail.

To be able to get CompactChip object from any layout element, fromLayoutElement method should be used, i.e.:

CompactChip myChip = CompactChip.fromLayoutElement(box.getContents().get(0));

Summary

Public functions

java-static CompactChip?

Returns CompactChip object from the given androidx.wear.tiles.LayoutElementBuilders.LayoutElement (e.g. one retrieved from a container's content with container.getContents().get(index)) if that element can be converted to CompactChip.

ChipColors

Returns chip color of this Chip.

ModifiersBuilders.Clickable

Returns click event action associated with this Chip.

String

Returns text content of this Chip.

Public functions

fromLayoutElement

Added in 1.1.0
Deprecated in 1.2.0
java-static fun fromLayoutElement(element: LayoutElementBuilders.LayoutElement): CompactChip?

Returns CompactChip object from the given androidx.wear.tiles.LayoutElementBuilders.LayoutElement (e.g. one retrieved from a container's content with container.getContents().get(index)) if that element can be converted to CompactChip. Otherwise, it will return null.

getChipColors

Added in 1.1.0
Deprecated in 1.2.0
fun getChipColors(): ChipColors

Returns chip color of this Chip.

getClickable

Added in 1.1.0
Deprecated in 1.2.0
fun getClickable(): ModifiersBuilders.Clickable

Returns click event action associated with this Chip.

getText

Added in 1.1.0
Deprecated in 1.2.0
fun getText(): String

Returns text content of this Chip.