CompactChip.Builder
public final class CompactChip.Builder
Builder class for CompactChip.
Summary
Public constructors |
|---|
Builder(Creates a builder for the |
Builder(Creates a builder for the |
Public methods |
|
|---|---|
@NonNull CompactChip |
build()Constructs and returns |
@NonNull CompactChip.Builder |
setChipColors(@NonNull ChipColors chipColors)Sets the colors for the |
@NonNull CompactChip.Builder |
setContentDescription(@NonNull CharSequence contentDescription)Sets the static content description for the |
@NonNull CompactChip.Builder |
setContentDescription(Sets the content description for the |
@NonNull CompactChip.Builder |
setIconContent(@NonNull String imageResourceId)Sets the icon for the |
@NonNull CompactChip.Builder |
setTextContent(@NonNull String text)Sets the text for the |
Public constructors
Builder
public Builder(
@NonNull Context context,
@NonNull ModifiersBuilders.Clickable clickable,
@NonNull DeviceParametersBuilders.DeviceParameters deviceParameters
)
Creates a builder for the CompactChip with associated action. Please add text, icon or both content with setTextContent and setIconContent.
| Parameters | |
|---|---|
@NonNull Context context |
The application's context. |
@NonNull ModifiersBuilders.Clickable clickable |
Associated |
@NonNull DeviceParametersBuilders.DeviceParameters deviceParameters |
The device parameters used for styling text. |
Builder
public Builder(
@NonNull Context context,
@NonNull String text,
@NonNull ModifiersBuilders.Clickable clickable,
@NonNull DeviceParametersBuilders.DeviceParameters deviceParameters
)
Creates a builder for the CompactChip with associated action and the given text.
| Parameters | |
|---|---|
@NonNull Context context |
The application's context. |
@NonNull String text |
The text to be displayed in this compact chip. |
@NonNull ModifiersBuilders.Clickable clickable |
Associated |
@NonNull DeviceParametersBuilders.DeviceParameters deviceParameters |
The device parameters used for styling text. |
Public methods
build
public @NonNull CompactChip build()
Constructs and returns CompactChip with the provided content and look.
setChipColors
public @NonNull CompactChip.Builder setChipColors(@NonNull ChipColors chipColors)
Sets the colors for the CompactChip. If set, getBackgroundColor will be used for the background of the button and getContentColor for the text. If not set, COMPACT_PRIMARY_COLORS will be used.
setContentDescription
public @NonNull CompactChip.Builder setContentDescription(@NonNull CharSequence contentDescription)
Sets the static content description for the CompactChip. It is highly recommended to provide this for chip containing an icon.
setContentDescription
public @NonNull CompactChip.Builder setContentDescription(
@NonNull 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).
setIconContent
public @NonNull CompactChip.Builder setIconContent(@NonNull 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.
setTextContent
public @NonNull CompactChip.Builder setTextContent(@NonNull String text)
Sets the text for the CompactChip.