# PaneTemplate.Builder

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

*** ** * ** ***


```
class PaneTemplate.Builder
```

<br />

*** ** * ** ***

A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#Builder(androidx.car.app.model.Pane)(pane: https://developer.android.com/reference/kotlin/androidx/car/app/model/Pane)` Returns a new instance of a @link Builder}. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#build()()` Constructs the template defined by this builder. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder` | `[setActionStrip](https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#setActionStrip(androidx.car.app.model.ActionStrip))(actionStrip: https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header.Builder#addEndHeaderAction(androidx.car.app.model.Action)` <br /> |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder` | `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/ExperimentalCarApi @https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi(value = 9) https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#setBanner(androidx.car.app.model.Banner)(banner: https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner)` Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner` for this template. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder` | `@https://developer.android.com/reference/kotlin/androidx/car/app/annotations/RequiresCarApi(value = 7) https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#setHeader(androidx.car.app.model.Header)(header: https://developer.android.com/reference/kotlin/androidx/car/app/model/Header)` Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header` for this template. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder` | `[setHeaderAction](https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#setHeaderAction(androidx.car.app.model.Action))(headerAction: https://developer.android.com/reference/kotlin/androidx/car/app/model/Action)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header.Builder#setStartHeaderAction(androidx.car.app.model.Action)` <br /> |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder` | `[setTitle](https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#setTitle(java.lang.CharSequence))(title: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header.Builder#setTitle(androidx.car.app.model.CarText)` <br /> |

## Public constructors

### Builder

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

```
Builder(pane: Pane)
```

Returns a new instance of a @link Builder}.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `pane` is `null` |

## Public functions

### build

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

```
fun build(): PaneTemplate
```

Constructs the template defined by this builder.

#### Requirements

The number of items in the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList` should be smaller or equal than the limit provided by `https://developer.android.com/reference/kotlin/androidx/car/app/constraints/ConstraintManager#CONTENT_LIMIT_TYPE_PANE()`. The host will ignore any rows over that limit. Each `https://developer.android.com/reference/kotlin/androidx/car/app/model/Row`s can add up to 2 lines of texts via `https://developer.android.com/reference/kotlin/androidx/car/app/model/Row.Builder#addText(java.lang.CharSequence)` and cannot contain either a `https://developer.android.com/reference/kotlin/androidx/car/app/model/Toggle` or a `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnClickListener`.

Up to 2 `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s are allowed in the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Pane`. Each action's title color can be customized with `https://developer.android.com/reference/kotlin/androidx/car/app/model/ForegroundCarColorSpan` instances. Any other span is not supported.

If none of the header `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`, the header title or the action strip have been set on the template, the header is hidden.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Pane` does not meet the requirements |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/constraints/ConstraintManager#getContentLimit(int)` |   |

### setActionStrip

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

```
fun [setActionStrip](https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#setActionStrip(androidx.car.app.model.ActionStrip))(actionStrip: ActionStrip): PaneTemplate.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header.Builder#addEndHeaderAction(androidx.car.app.model.Action)`

Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip` for this template.

Unless set with this method, the template will not have an action strip.

#### Requirements

This template allows up to 2 `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s in its `https://developer.android.com/reference/kotlin/androidx/car/app/model/ActionStrip`. Of the 2 allowed `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s, one of them can contain a title as set via `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action.Builder#setTitle(java.lang.CharSequence)`. Otherwise, only `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s with icons are allowed.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `actionStrip` does not meet the requirements |
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `actionStrip` is `null` |

### setBanner

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

```
@ExperimentalCarApi
@RequiresCarApi(value = 9)
fun setBanner(banner: Banner): PaneTemplate.Builder
```

Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Banner` for this template.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `banner` is `null` |

### setHeader

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

```
@RequiresCarApi(value = 7)
fun setHeader(header: Header): PaneTemplate.Builder
```

Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header` for this template.

The end header actions will show up differently inside vs outside of a map template. See `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header.Builder#addEndHeaderAction(androidx.car.app.model.Action)` for more details.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `header` is null |

### setHeaderAction

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

```
fun [setHeaderAction](https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#setHeaderAction(androidx.car.app.model.Action))(headerAction: Action): PaneTemplate.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header.Builder#setStartHeaderAction(androidx.car.app.model.Action)`

Sets the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action` that will be displayed in the header of the template.

Unless set with this method, the template will not have a header action.

#### Requirements

This template only supports either one of `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action#APP_ICON()` and `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action#BACK()` as a header `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `headerAction` does not meet the template's requirements |
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `headerAction` is `null` |

### setTitle

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

```
fun [setTitle](https://developer.android.com/reference/kotlin/androidx/car/app/model/PaneTemplate.Builder#setTitle(java.lang.CharSequence))(title: CharSequence): PaneTemplate.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/car/app/model/Header.Builder#setTitle(androidx.car.app.model.CarText)`

Sets the title of the template.

Unless set with this method, the template will not have a title.

Only `https://developer.android.com/reference/kotlin/androidx/car/app/model/DistanceSpan`s, `https://developer.android.com/reference/kotlin/androidx/car/app/model/DurationSpan`s and `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIconSpan` are supported in the input string.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `title` is `null` |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if `title` contains unsupported spans |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText` |   |