TabStyle.Builder


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


A builder for TabStyle.

Summary

Public constructors

Returns an empty TabStyle.Builder instance.

Builder(tabStyle: TabStyle)

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

Public functions

TabStyle

Constructs a TabStyle from the current state of this builder.

TabStyle.Builder
setSelectedBackgroundColor(selectedBackgroundColor: CarColor?)

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

TabStyle.Builder
setShape(shape: Shape?)

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

TabStyle.Builder
setTextColor(textColor: CarColor?)

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
Builder()

Returns an empty TabStyle.Builder instance.

Builder

Added in 1.9.0-alpha02
Builder(tabStyle: TabStyle)

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

Public functions

build

Added in 1.9.0-alpha02
fun build(): TabStyle

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
fun setSelectedBackgroundColor(selectedBackgroundColor: CarColor?): TabStyle.Builder

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
fun setShape(shape: Shape?): TabStyle.Builder

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
fun setTextColor(textColor: CarColor?): TabStyle.Builder

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