Banner


@ExperimentalCarApi
@CarProtocol
@RequiresCarApi(value = 9)
public final class Banner implements Item


A banner element that's meant to be visually distinct from other normal elements on the screen.

For example, a banner can be used to tell the user whether the app is running in an online vs offline mode, or promote a specific event or announcement.

Summary

Nested types

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

A builder of Banner.

Constants

static final int

Represents a large edge-to-edge image to be displayed in the banner.

static final int

Represents a medium padded artwork image to be displayed in the banner.

static final int

Represents a small icon-sized image to be displayed in the banner.

Public methods

boolean
@NonNull List<Action>

Returns the list of actions below the title and subtitle.

@Nullable BannerElement

Returns the leading element of the banner.

@Nullable OnClickDelegate

Returns the OnClickDelegate to be called back when the banner is clicked.

@Nullable BannerStyle

Returns the BannerStyle of the banner, or null if not set.

@Nullable CarText

Returns the subtitle of the banner.

@Nullable CarText

Returns the title of the banner.

@NonNull List<BannerElement>

Returns the list of trailing elements of the banner.

int
@NonNull String

Constants

IMAGE_TYPE_LARGE

Added in 1.9.0-alpha02
public static final int IMAGE_TYPE_LARGE = 3

Represents a large edge-to-edge image to be displayed in the banner. Scales the image to fill the container and potentially clip within the bounds if a shape is applied.

This image type cannot be used in combination with addBelowAction.

IMAGE_TYPE_MEDIUM

Added in 1.9.0-alpha02
public static final int IMAGE_TYPE_MEDIUM = 2

Represents a medium padded artwork image to be displayed in the banner.

The host renders it with standard padding and scales the image to fit within the bounds.

IMAGE_TYPE_SMALL

Added in 1.9.0-alpha02
public static final int IMAGE_TYPE_SMALL = 1

Represents a small icon-sized image to be displayed in the banner.

The host renders it with standard padding and scales the image to fit within the bounds.

Public methods

equals

public boolean equals(@Nullable Object other)

getBelowActions

Added in 1.8.0
public @NonNull List<ActiongetBelowActions()

Returns the list of actions below the title and subtitle.

See also
addBelowAction

getLeadingElement

Added in 1.9.0-alpha02
public @Nullable BannerElement getLeadingElement()

Returns the leading element of the banner.

This is currently restricted to icons and images only.

getOnClickDelegate

Added in 1.8.0
public @Nullable OnClickDelegate getOnClickDelegate()

Returns the OnClickDelegate to be called back when the banner is clicked.

getStyle

Added in 1.9.0-alpha02
public @Nullable BannerStyle getStyle()

Returns the BannerStyle of the banner, or null if not set.

See also
setStyle

getSubtitle

Added in 1.8.0
public @Nullable CarText getSubtitle()

Returns the subtitle of the banner.

The subtitle is automatically truncated if it's too long; however, shorter variants can be added via addVariant.

See also
setSubtitle

getTitle

Added in 1.8.0
public @Nullable CarText getTitle()

Returns the title of the banner.

The title is automatically truncated if it's too long; however, shorter variants can be added via addVariant.

See also
setTitle

getTrailingElements

Added in 1.9.0-alpha02
public @NonNull List<BannerElementgetTrailingElements()

Returns the list of trailing elements of the banner.

hashCode

public int hashCode()

toString

public @NonNull String toString()