# Background

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/Background.java+class:androidx.car.app.model.Background) Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

*** ** * ** ***


```
@CarProtocol
@ExperimentalCarApi
@RequiresCarApi(value = 9)
class Background
```

<br />

*** ** * ** ***

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 `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor` or an image using `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon`. Only one of these can be set at a time.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/car/app/model/Background.Builder` A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/model/Background`. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/car/app/model/Background` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Background#TRANSPARENT()` A transparent background. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Background#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Background#getColor()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor` used for the background, or `null` if not set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Background#getImage()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon` associated with this background, or `null` if not set. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Background#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/Background#toString()()` |

## Constants

### TRANSPARENT

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

```
const val TRANSPARENT: Background
```

A transparent background.

## Public functions

### equals

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

### getColor

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

```
fun getColor(): CarColor?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarColor` used for the background, or `null` if not set.

### getImage

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

```
fun getImage(): CarIcon?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon` associated with this background, or `null` if not set.

### hashCode

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

### toString

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