Background


@CarProtocol
@ExperimentalCarApi
@RequiresCarApi(value = 9)
public final class Background


A background for a user interface component.

The image or color will be modified to ensure safe a color contrast ratio with the content.

The background can be set as either a solid color using CarColor or an image using CarIcon. Only one of these can be set at a time.

Summary

Nested types

public final class Background.Builder

A builder of Background.

Constants

static final @NonNull Background

A transparent background.

Public methods

boolean
@Nullable CarColor

Returns the CarColor used for the background, or null if not set.

@Nullable CarIcon

Returns the CarIcon associated with this background, or null if not set.

int
@NonNull String

Constants

TRANSPARENT

Added in 1.8.0
public static final @NonNull Background TRANSPARENT

A transparent background.

Public methods

equals

public boolean equals(@Nullable Object other)

getColor

Added in 1.8.0
public @Nullable CarColor getColor()

Returns the CarColor used for the background, or null if not set.

getImage

Added in 1.8.0
public @Nullable CarIcon getImage()

Returns the CarIcon associated with this background, or null if not set.

hashCode

public int hashCode()

toString

public @NonNull String toString()