# Banner

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/model/Banner.java+class:androidx.car.app.model.Banner) Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

*** ** * ** ***


```
@ExperimentalCarApi
@CarProtocol
@RequiresCarApi(value = 9)
class Banner : Item
```

<br />

*** ** * ** ***

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 |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi(value = 9) @https://developer.android.com/reference/kotlin/androidx/car/app/annotations/ExperimentalCarApi class https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder` A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner`. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#IMAGE_TYPE_LARGE() = 3` Represents a large edge-to-edge image to be displayed in the banner. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#IMAGE_TYPE_MEDIUM() = 2` Represents a medium padded artwork image to be displayed in the banner. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#IMAGE_TYPE_SMALL() = 1` Represents a small icon-sized image to be displayed in the banner. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/car/app/model/Action!>` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#getBelowActions()()` Returns the list of actions below the title and subtitle. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#getLeadingElement()()` Returns the leading element of the banner. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnClickDelegate?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#getOnClickDelegate()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnClickDelegate` to be called back when the banner is clicked. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerStyle?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#getStyle()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerStyle` of the banner, or `null` if not set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#getSubtitle()()` Returns the subtitle of the banner. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#getTitle()()` Returns the title of the banner. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement!>` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#getTrailingElements()()` Returns the list of trailing elements of the banner. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner#toString()()` |

## Constants

### IMAGE_TYPE_LARGE

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
const val IMAGE_TYPE_LARGE = 3: Int
```

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 `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#addBelowAction(androidx.car.app.model.Action)`.

### IMAGE_TYPE_MEDIUM

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
const val IMAGE_TYPE_MEDIUM = 2: Int
```

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-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
const val IMAGE_TYPE_SMALL = 1: Int
```

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 functions

### equals

```
fun equals(other: Any?): Boolean
```

### getBelowActions

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
fun getBelowActions(): (Mutable)List<Action!>
```

Returns the list of actions below the title and subtitle.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#addBelowAction(androidx.car.app.model.Action)` |   |

### getLeadingElement

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
fun getLeadingElement(): BannerElement?
```

Returns the leading element of the banner.

This is currently restricted to icons and images only.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#setLeadingImage(androidx.car.app.model.CarIcon)` |   |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#setLeadingImage(androidx.car.app.model.CarIcon,int)` |   |

### getOnClickDelegate

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
fun getOnClickDelegate(): OnClickDelegate?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnClickDelegate` to be called back when the banner is clicked.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#setOnClickListener(androidx.car.app.model.OnClickListener)` |   |

### getStyle

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
fun getStyle(): BannerStyle?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerStyle` of the banner, or `null` if not set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#setStyle(androidx.car.app.model.BannerStyle)` |   |

### getSubtitle

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
fun getSubtitle(): CarText?
```

Returns the subtitle of the banner.

The subtitle is automatically truncated if it's too long; however, shorter variants can be added via `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText.Builder#addVariant(java.lang.CharSequence)`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#setSubtitle(java.lang.CharSequence)` |   |

### getTitle

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
fun getTitle(): CarText?
```

Returns the title of the banner.

The title is automatically truncated if it's too long; however, shorter variants can be added via `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText.Builder#addVariant(java.lang.CharSequence)`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#setTitle(java.lang.CharSequence)` |   |

### getTrailingElements

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
fun getTrailingElements(): (Mutable)List<BannerElement!>
```

Returns the list of trailing elements of the banner.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#addTrailingAction(androidx.car.app.model.Action)` |   |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#addTrailingImage(androidx.car.app.model.CarIcon)` |   |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner.Builder#addTrailingImage(androidx.car.app.model.CarIcon,int)` |   |

### hashCode

```
fun hashCode(): Int
```

### toString

```
fun toString(): String
```