# ModifiersBuilders.Background.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/ModifiersBuilders.java+class:androidx.wear.protolayout.ModifiersBuilders.Background.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


```
public final class ModifiersBuilders.Background.Builder
```

<br />

*** ** * ** ***

Builder for `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background`

## Summary

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

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background.Builder#build()()` Builds an instance from accumulated values. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 500) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background.Builder#setBrush(androidx.wear.protolayout.ColorBuilders.Brush)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ColorBuilders.Brush brush)` Sets a brush used to draw the background. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 0) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background.Builder#setColor(androidx.wear.protolayout.ColorBuilders.ColorProp)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ColorBuilders.ColorProp color)` Sets the background color for this element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background.Builder` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 0) https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background.Builder#setCorner(androidx.wear.protolayout.ModifiersBuilders.Corner)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Corner corner)` Sets the corner properties of this element. |

## 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/ModifiersBuilders.Background.Builder`.

## Public methods

### build

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

```
public @NonNull ModifiersBuilders.Background build()
```

Builds an instance from accumulated values.

### setBrush

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

```
@RequiresSchemaVersion(major = 1, minor = 500)
public @NonNull ModifiersBuilders.Background.Builder setBrush(@NonNull ColorBuilders.Brush brush)
```

Sets a brush used to draw the background. If set and supported, the brush will be used instead of the color provided in `setColor()`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the brush is not a `https://developer.android.com/reference/androidx/wear/protolayout/ColorBuilders.LinearGradient`. |

### setColor

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

```
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull ModifiersBuilders.Background.Builder setColor(@NonNull ColorBuilders.ColorProp color)
```

Sets the background color for this element. If not defined, defaults to being transparent.

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).

If a brush is set, this color will only be used if brush is not supported by the renderer (versions below 1.5).

### setCorner

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

```
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull ModifiersBuilders.Background.Builder setCorner(@NonNull ModifiersBuilders.Corner corner)
```

Sets the corner properties of this element. This only affects the drawing of this element if it has a background color or border. If not defined, defaults to having a square corner.