# ModifiersBuilders.Background

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

*** ** * ** ***

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

<br />

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

<br />

*** ** * ** ***

A modifier to apply a background to an element.

## Summary

|                                                                                                                                       ### Nested types                                                                                                                                       |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[ModifiersBuilders.Background.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background.Builder) Builder for[Background](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background) |

|                                                       ### Public functions                                                       |
|----------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ColorBuilders.Brush](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.Brush)`?`           | [getBrush](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background#getBrush())`()` Gets a brush used to draw the background.     |
| [ColorBuilders.ColorProp](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ColorBuilders.ColorProp)`?`   | [getColor](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background#getColor())`()` Gets the background color for this element.   |
| [ModifiersBuilders.Corner](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Corner)`?` | [getCorner](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background#getCorner())`()` Gets the corner properties of this element. |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                | [toString](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/ModifiersBuilders.Background#toString())`()`                                               |

## Public functions

### getBrush

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

```
fun getBrush(): ColorBuilders.Brush?
```

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)  

```
fun getColor(): ColorBuilders.ColorProp?
```

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)  

```
fun getCorner(): ModifiersBuilders.Corner?
```

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

```
fun toString(): String
```