public final class

TitleChip.Builder

extends java.lang.Object

implements LayoutElementBuilders.LayoutElement.Builder

 java.lang.Object

↳androidx.wear.protolayout.material.TitleChip.Builder

Overview

Builder class for TitleChip.

Summary

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

Creates a builder for the TitleChip with associated action and the given text

Methods
public TitleChipbuild()

Constructs and returns TitleChip with the provided content and look.

public TitleChip.BuildersetChipColors(ChipColors chipColors)

Sets the colors for the TitleChip.

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

Sets the static content description for the TitleChip.

public TitleChip.BuildersetContentDescription(TypeBuilders.StringProp contentDescription)

Sets the content description for the TitleChip.

public TitleChip.BuildersetHorizontalAlignment(int horizontalAlignment)

Sets the horizontal alignment in the chip.

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

Sets the icon for the TitleChip.

public TitleChip.BuildersetWidth(DimensionBuilders.ContainerDimension width)

Sets the width of TitleChip.

public TitleChip.BuildersetWidth(float width)

Sets the width of TitleChip.

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 TitleChip with associated action and the given text

Parameters:

context: The application's context.
text: The text to be displayed in this title chip. Text will be displayed in 1 line and truncated if it doesn't fit.
clickable: Associated ModifiersBuilders.Clickable for click events. When the TitleChip is clicked it will fire the associated action.
deviceParameters: The device parameters used for styling text.

Methods

public TitleChip.Builder setChipColors(ChipColors chipColors)

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

public TitleChip.Builder setHorizontalAlignment(int horizontalAlignment)

Sets the horizontal alignment in the chip. If not set, content will be centered.

Sets the width of TitleChip. If not set, default value will be set to fill the screen.

public TitleChip.Builder setWidth(float width)

Sets the width of TitleChip. If not set, default value will be set to fill the screen.

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

Sets the icon for the TitleChip. 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 TitleChip.Builder setContentDescription(java.lang.CharSequence contentDescription)

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

public TitleChip.Builder setContentDescription(TypeBuilders.StringProp contentDescription)

Sets the content description for the TitleChip. 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 TitleChip build()

Constructs and returns TitleChip with the provided content and look.