# PrimaryLayout.Builder

Artifact: [androidx.wear.tiles:tiles-material](https://developer.android.com/jetpack/androidx/releases/wear-tiles) [View Source](https://cs.android.com/search?q=file:androidx/wear/tiles/material/layouts/PrimaryLayout.java+class:androidx.wear.tiles.material.layouts.PrimaryLayout.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

*** ** * ** ***


```
public final class PrimaryLayout.Builder implements LayoutElementBuilders.LayoutElement.Builder
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> Deprecated in Java

Builder class for `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout`.

## Summary

| ### Public constructors |
|---|
| `[Builder](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#Builder(androidx.wear.tiles.DeviceParametersBuilders.DeviceParameters))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/DeviceParametersBuilders.DeviceParameters deviceParameters )` **This method is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout` | `[build](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#build())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder` | `[setContent](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders.LayoutElement content)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder` | `[setPrimaryChipContent](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setPrimaryChipContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders.LayoutElement compactChip )` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder` | `[setPrimaryLabelTextContent](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setPrimaryLabelTextContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders.LayoutElement primaryLabelText )` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder` | `[setSecondaryLabelTextContent](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setSecondaryLabelTextContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders.LayoutElement secondaryLabelText )` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder` | `[setVerticalSpacerHeight](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setVerticalSpacerHeight(float))(@https://developer.android.com/reference/androidx/annotation/Dimension(unit = 0) float height)` **This method is deprecated.** Deprecated in Java |

## Public constructors

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public [Builder](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#Builder(androidx.wear.tiles.DeviceParametersBuilders.DeviceParameters))(
    @NonNull DeviceParametersBuilders.DeviceParameters deviceParameters
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Creates a builder for the `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout` from the given content. Content inside of it can later be set with `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement)`, `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setPrimaryChipContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement)`, `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setPrimaryLabelTextContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement)` and `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setSecondaryLabelTextContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement)`.

## Public methods

### build

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull PrimaryLayout [build](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#build())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Constructs and returns `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout` with the provided content and look.

### setContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull PrimaryLayout.Builder [setContent](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(@NonNull LayoutElementBuilders.LayoutElement content)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the additional content to this layout, above the primary chip.

The content slot will wrap the elements' height, so the height of the given content must be fixed or set to wrap (`expand` can't be used).

This layout has built-in horizontal margins, so the given content should have width set to `expand` to use all the available space, rather than an explicit width which may lead to clipping.

### setPrimaryChipContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull PrimaryLayout.Builder [setPrimaryChipContent](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setPrimaryChipContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(
    @NonNull LayoutElementBuilders.LayoutElement compactChip
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the element which is in the slot at the bottom of the layout. Note that it is accepted to pass in any `https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders.LayoutElement`, but it is strongly recommended to add a CompactChip as the layout is optimized for it.

### setPrimaryLabelTextContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull PrimaryLayout.Builder [setPrimaryLabelTextContent](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setPrimaryLabelTextContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(
    @NonNull LayoutElementBuilders.LayoutElement primaryLabelText
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the content in the primary label slot which will be above the main content.

### setSecondaryLabelTextContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull PrimaryLayout.Builder [setSecondaryLabelTextContent](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setSecondaryLabelTextContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(
    @NonNull LayoutElementBuilders.LayoutElement secondaryLabelText
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the content in the primary label slot which will be below the main content. It is highly recommended to have primary label set when having secondary label.

### setVerticalSpacerHeight

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull PrimaryLayout.Builder [setVerticalSpacerHeight](https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setVerticalSpacerHeight(float))(@Dimension(unit = 0) float height)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the vertical spacer height which is used as a space between main content and secondary label if there is any. If not set, `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/LayoutDefaults#DEFAULT_VERTICAL_SPACER_HEIGHT()` will be used.