# ModifiersBuilders.Background

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

*** ** * ** ***


```
@RequiresSchemaVersion(major = 1, minor = 0)
public final class ModifiersBuilders.Background
```

<br />

*** ** * ** ***

A modifier to apply a background to an element.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background.Builder` Builder for `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background` |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/ColorBuilders.Brush` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background#getBrush()()` Gets a brush used to draw the background. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/ColorBuilders.ColorProp` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background#getColor()()` Gets the background color for this element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Corner` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background#getCorner()()` Gets the corner properties of this element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background#toString()()` |

## Public methods

### getBrush

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

```
public @Nullable ColorBuilders.Brush getBrush()
```

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

### getColor

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

```
public @Nullable ColorBuilders.ColorProp getColor()
```

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

### getCorner

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

```
public @Nullable ModifiersBuilders.Corner getCorner()
```

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

### toString

```
public @NonNull String toString()
```