# LayoutElementBuilders.Spacer.Builder

Artifact: [androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/LayoutElementBuilders.java+class:androidx.wear.protolayout.LayoutElementBuilders.Spacer.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


```
public final class LayoutElementBuilders.Spacer.Builder
```

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#Builder()()` Creates an instance of `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder`. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#build()()` Builds an instance with values accumulated in this Builder. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 0) https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#setHeight(androidx.wear.protolayout.DimensionBuilders.SpacerDimension)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.SpacerDimension height)` Sets the height of this spacer. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#setLayoutConstraintsForDynamicHeight(androidx.wear.protolayout.DimensionBuilders.VerticalLayoutConstraint)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.VerticalLayoutConstraint verticalLayoutConstraint )` Sets the bounding constraints for the layout affected by the dynamic value from `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#setHeight(androidx.wear.protolayout.DimensionBuilders.SpacerDimension)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 200) https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#setLayoutConstraintsForDynamicWidth(androidx.wear.protolayout.DimensionBuilders.HorizontalLayoutConstraint)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.HorizontalLayoutConstraint horizontalLayoutConstraint )` Sets the bounding constraints for the layout affected by the dynamic value from `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#setWidth(androidx.wear.protolayout.DimensionBuilders.SpacerDimension)`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 0) https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#setModifiers(androidx.wear.protolayout.ModifiersBuilders.Modifiers)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Modifiers modifiers)` Sets `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Modifiers` for this element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 0) https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#setWidth(androidx.wear.protolayout.DimensionBuilders.SpacerDimension)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.SpacerDimension width)` Sets the width of this `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer`. |

## Public constructors

### Builder

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

```
public Builder()
```

Creates an instance of `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder`.

## Public methods

### build

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

```
public @NonNull LayoutElementBuilders.Spacer build()
```

Builds an instance with values accumulated in this Builder.

### setHeight

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

```
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Spacer.Builder setHeight(@NonNull DimensionBuilders.SpacerDimension height)
```

Sets the height of this spacer. If not defined, defaults to 0.

While this field is statically accessible from 1.0, it's only bindable since version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).

### setLayoutConstraintsForDynamicHeight

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

```
@RequiresSchemaVersion(major = 1, minor = 200)
public @NonNull LayoutElementBuilders.Spacer.Builder setLayoutConstraintsForDynamicHeight(
    @NonNull DimensionBuilders.VerticalLayoutConstraint verticalLayoutConstraint
)
```

Sets the bounding constraints for the layout affected by the dynamic value from `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#setHeight(androidx.wear.protolayout.DimensionBuilders.SpacerDimension)`. If the `https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.SpacerDimension` does not have a dynamic value, this will be ignored.

### setLayoutConstraintsForDynamicWidth

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

```
@RequiresSchemaVersion(major = 1, minor = 200)
public @NonNull LayoutElementBuilders.Spacer.Builder setLayoutConstraintsForDynamicWidth(
    @NonNull DimensionBuilders.HorizontalLayoutConstraint horizontalLayoutConstraint
)
```

Sets the bounding constraints for the layout affected by the dynamic value from `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer.Builder#setWidth(androidx.wear.protolayout.DimensionBuilders.SpacerDimension)`. If the `https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.SpacerDimension` does not have a dynamic value, this will be ignored.

### setModifiers

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

```
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Spacer.Builder setModifiers(@NonNull ModifiersBuilders.Modifiers modifiers)
```

Sets `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Modifiers` for this element.

### setWidth

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

```
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Spacer.Builder setWidth(@NonNull DimensionBuilders.SpacerDimension width)
```

Sets the width of this `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spacer`. When this is added as the direct child of an `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Arc`, this must be specified as an angular dimension, otherwise a linear dimension must be used. If not defined, defaults to 0.

While this field is statically accessible from 1.0, it's only bindable since version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).