# ModifiersBuilders.Background.Builder

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Background.Builder "View this page in Java")

<br />

```
class ModifiersBuilders.Background.Builder
```

<br />

*** ** * ** ***

Builder for[Background](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background)

## Summary

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

|                                                                 ### Public functions                                                                  |
|-------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ModifiersBuilders.Background](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background)                 | [build](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background.Builder#build())`()` Builds an instance from accumulated values.                                                                                                                                                                                                                                                                                                                                                                |
| [ModifiersBuilders.Background.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background.Builder) | `@`[RequiresSchemaVersion](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion)`(major = 1, minor = 500)` [setBrush](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background.Builder#setBrush(androidx.wear.protolayout.ColorBuilders.Brush))`(brush: `[ColorBuilders.Brush](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.Brush)`)` Sets a brush used to draw the background.                   |
| [ModifiersBuilders.Background.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background.Builder) | `@`[RequiresSchemaVersion](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion)`(major = 1, minor = 0)` [setColor](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background.Builder#setColor(androidx.wear.protolayout.ColorBuilders.ColorProp))`(color: `[ColorBuilders.ColorProp](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.ColorProp)`)` Sets the background color for this element.       |
| [ModifiersBuilders.Background.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background.Builder) | `@`[RequiresSchemaVersion](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion)`(major = 1, minor = 0)` [setCorner](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background.Builder#setCorner(androidx.wear.protolayout.ModifiersBuilders.Corner))`(corner: `[ModifiersBuilders.Corner](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.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)  

```
Builder()
```

Creates an instance of[Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background.Builder).  

## Public functions

### build

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

```
fun build(): ModifiersBuilders.Background
```

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)
fun setBrush(brush: ColorBuilders.Brush): ModifiersBuilders.Background.Builder
```

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                                                         |
|-----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| [java.lang.IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if the brush is not a[LinearGradient](https://developer.android.com/reference/kotlin/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)
fun setColor(color: ColorBuilders.ColorProp): ModifiersBuilders.Background.Builder
```

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)
fun setCorner(corner: ModifiersBuilders.Corner): ModifiersBuilders.Background.Builder
```

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.