TabStyle.Builder


@RequiresCarApi(value = 9)
@ExperimentalCarApi
public final class TabStyle.Builder


A builder for TabStyle.

Summary

Public constructors

Returns an empty TabStyle.Builder instance.

Creates a new TabStyle.Builder, populated from the input TabStyle.

Public methods

@NonNull TabStyle

Constructs a TabStyle from the current state of this builder.

@NonNull TabStyle.Builder
setSelectedBackgroundColor(@Nullable CarColor selectedBackgroundColor)

Sets the CarColor of the tab indicator background when selected, or null to clear the color.

@NonNull TabStyle.Builder

Sets the Shape of the container, or null to clear the shape.

@NonNull TabStyle.Builder

Sets the CarColor for text displayed within the tab container, or null to clear the color.

Public constructors

Builder

Added in 1.9.0-alpha02
public Builder()

Returns an empty TabStyle.Builder instance.

Builder

Added in 1.9.0-alpha02
public Builder(@NonNull TabStyle tabStyle)

Creates a new TabStyle.Builder, populated from the input TabStyle.

Public methods

build

Added in 1.9.0-alpha02
public @NonNull TabStyle build()

Constructs a TabStyle from the current state of this builder.

Throws
java.lang.IllegalStateException

if shape, selected background color, and text color are all unset.

setSelectedBackgroundColor

Added in 1.9.0-alpha02
public @NonNull TabStyle.Builder setSelectedBackgroundColor(@Nullable CarColor selectedBackgroundColor)

Sets the CarColor of the tab indicator background when selected, or null to clear the color.

If a selected background color is not set or is cleared, the background color will fall back to host defaults.

Custom background colors are applied only when the tab is active (selected). On an unselected tab, the background color is ignored by the host and defaults to transparent.

Throws
java.lang.IllegalArgumentException

if selectedBackgroundColor contains an unsupported color type

setShape

Added in 1.9.0-alpha02
public @NonNull TabStyle.Builder setShape(@Nullable Shape shape)

Sets the Shape of the container, or null to clear the shape.

If a shape is not set or is cleared, the container shape will fall back to host defaults.

setTextColor

Added in 1.9.0-alpha02
public @NonNull TabStyle.Builder setTextColor(@Nullable CarColor textColor)

Sets the CarColor for text displayed within the tab container, or null to clear the color.

If a text color is not set or is cleared, the text color will fall back to host defaults.

To customize the color of the tab's icon, see setTint.

Throws
java.lang.IllegalArgumentException

if textColor contains an unsupported color type