public final class

CompactChip.Builder

extends java.lang.Object

implements LayoutElementBuilders.LayoutElement.Builder

 java.lang.Object

↳androidx.wear.protolayout.material.CompactChip.Builder

Overview

Builder class for CompactChip.

Summary

Constructors
publicBuilder(Context context, ModifiersBuilders.Clickable clickable, DeviceParametersBuilders.DeviceParameters deviceParameters)

Creates a builder for the CompactChip with associated action.

publicBuilder(Context context, java.lang.String text, ModifiersBuilders.Clickable clickable, DeviceParametersBuilders.DeviceParameters deviceParameters)

Creates a builder for the CompactChip with associated action and the given text.

Methods
public CompactChipbuild()

Constructs and returns CompactChip with the provided content and look.

public CompactChip.BuildersetChipColors(ChipColors chipColors)

Sets the colors for the CompactChip.

public CompactChip.BuildersetContentDescription(java.lang.CharSequence contentDescription)

Sets the static content description for the CompactChip.

public CompactChip.BuildersetContentDescription(TypeBuilders.StringProp contentDescription)

Sets the content description for the CompactChip.

public CompactChip.BuildersetIconContent(java.lang.String imageResourceId)

Sets the icon for the CompactChip.

public CompactChip.BuildersetTextContent(java.lang.String text)

Sets the text for the CompactChip.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(Context context, java.lang.String text, ModifiersBuilders.Clickable clickable, DeviceParametersBuilders.DeviceParameters deviceParameters)

Creates a builder for the CompactChip with associated action and the given text.

Parameters:

context: The application's context.
text: The text to be displayed in this compact chip.
clickable: Associated ModifiersBuilders.Clickable for click events. When the CompactChip is clicked it will fire the associated action.
deviceParameters: The device parameters used for styling text.

public Builder(Context context, ModifiersBuilders.Clickable clickable, DeviceParametersBuilders.DeviceParameters deviceParameters)

Creates a builder for the CompactChip with associated action. Please add text, icon or both content with CompactChip.Builder.setTextContent(String) and CompactChip.Builder.setIconContent(String).

Parameters:

context: The application's context.
clickable: Associated ModifiersBuilders.Clickable for click events. When the CompactChip is clicked it will fire the associated action.
deviceParameters: The device parameters used for styling text.

Methods

public CompactChip.Builder setTextContent(java.lang.String text)

Sets the text for the CompactChip.

public CompactChip.Builder setChipColors(ChipColors chipColors)

Sets the colors for the CompactChip. If set, ChipColors.getBackgroundColor() will be used for the background of the button and ChipColors.getContentColor() for the text. If not set, ChipDefaults.COMPACT_PRIMARY_COLORS will be used.

public CompactChip.Builder setIconContent(java.lang.String imageResourceId)

Sets the icon for the CompactChip. Provided icon will be tinted to the given content color from ChipColors. This icon should be image with chosen alpha channel that can be tinted.

public CompactChip.Builder setContentDescription(java.lang.CharSequence contentDescription)

Sets the static content description for the CompactChip. It is highly recommended to provide this for chip containing an icon.

public CompactChip.Builder setContentDescription(TypeBuilders.StringProp contentDescription)

Sets the content description for the CompactChip. It is highly recommended to provide this for chip containing an icon.

While this field is statically accessible from 1.0, it's only bindable since version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).

public CompactChip build()

Constructs and returns CompactChip with the provided content and look.