# Button.Builder

Artifact: [androidx.wear.tiles:tiles-material](https://developer.android.com/jetpack/androidx/releases/wear-tiles) [View Source](https://cs.android.com/search?q=file:androidx/wear/tiles/material/Button.java+class:androidx.wear.tiles.material.Button.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

*** ** * ** ***


```
class Button.Builder : LayoutElementBuilders.LayoutElement.Builder
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> Deprecated in Java

Builder class for `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button`.

## Summary

| ### Public constructors |
|---|
| `[Builder](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#Builder(android.content.Context,androidx.wear.tiles.ModifiersBuilders.Clickable))(context: https://developer.android.com/reference/android/content/Context.html, clickable: https://developer.android.com/reference/kotlin/androidx/wear/tiles/ModifiersBuilders.Clickable)` **This function is deprecated.** Deprecated in Java |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button` | `[build](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#build())()` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setButtonColors](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setButtonColors(androidx.wear.tiles.material.ButtonColors))(buttonColors: https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonColors)` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setContentDescription](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setContentDescription(java.lang.CharSequence))(contentDescription: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setCustomContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setCustomContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(content: https://developer.android.com/reference/kotlin/androidx/wear/tiles/LayoutElementBuilders.LayoutElement)` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setIconContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String))(imageResourceId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setIconContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String,androidx.wear.tiles.DimensionBuilders.DpProp))(imageResourceId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, size: https://developer.android.com/reference/kotlin/androidx/wear/tiles/DimensionBuilders.DpProp)` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setImageContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setImageContent(java.lang.String))(imageResourceId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setSize](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setSize(androidx.wear.tiles.DimensionBuilders.DpProp))(size: https://developer.android.com/reference/kotlin/androidx/wear/tiles/DimensionBuilders.DpProp)` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setSize](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setSize(float))(size: @https://developer.android.com/reference/kotlin/androidx/annotation/Dimension(unit = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setTextContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String))(text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder` | `[setTextContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String,int))(text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, typographyName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** Deprecated in Java |

## Public constructors

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
[Builder](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#Builder(android.content.Context,androidx.wear.tiles.ModifiersBuilders.Clickable))(context: Context, clickable: ModifiersBuilders.Clickable)
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Creates a builder for the `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button` from the given content. Custom content should be later set with one of the following (`https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String,androidx.wear.tiles.DimensionBuilders.DpProp)`, `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String)`, `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setImageContent(java.lang.String)`.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The application's context. |
| `clickable: https://developer.android.com/reference/kotlin/androidx/wear/tiles/ModifiersBuilders.Clickable` | Associated `https://developer.android.com/reference/kotlin/androidx/wear/tiles/ModifiersBuilders.Clickable` for click events. When the Button is clicked it will fire the associated action. |

## Public functions

### build

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [build](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#build())(): Button
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Constructs and returns `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button` with the provided field and look.

### setButtonColors

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setButtonColors](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setButtonColors(androidx.wear.tiles.material.ButtonColors))(buttonColors: ButtonColors): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the colors for the `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button`. If not set, `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#PRIMARY_COLORS()` will be used.

### setContentDescription

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setContentDescription](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setContentDescription(java.lang.CharSequence))(contentDescription: CharSequence): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the content description for the `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button`. It is highly recommended to provide this for button containing icon or image.

### setCustomContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setCustomContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setCustomContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(content: LayoutElementBuilders.LayoutElement): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the custom content for this Button. Any previously added content will be overridden.

### setIconContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setIconContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String))(imageResourceId: String): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given icon with the default size that is half of the set size of the button. Any previously added content will be overridden. Provided icon will be tinted to the given content color from `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonColors`. This icon should be image with chosen alpha channel and not an actual image.

### setIconContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setIconContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String,androidx.wear.tiles.DimensionBuilders.DpProp))(imageResourceId: String, size: DimensionBuilders.DpProp): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given icon with the given size. Any previously added content will be overridden. Provided icon will be tinted to the given content color from `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonColors` and with the given size. This icon should be image with chosen alpha channel and not an actual image.

### setImageContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setImageContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setImageContent(java.lang.String))(imageResourceId: String): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given image, i.e. contacts photo. Any previously added content will be overridden.

### setSize

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setSize](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setSize(androidx.wear.tiles.DimensionBuilders.DpProp))(size: DimensionBuilders.DpProp): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the size for the `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button`. Strongly recommended values are `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()`, `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#LARGE_SIZE()` and `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#EXTRA_LARGE_SIZE()`. If not set, `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()` will be used.

### setSize

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setSize](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setSize(float))(size: @Dimension(unit = 0) Float): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the size for the `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button`. Strongly recommended values are `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()`, `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#LARGE_SIZE()` and `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#EXTRA_LARGE_SIZE()`. If not set, `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()` will be used.

### setTextContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setTextContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String))(text: String): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given text with the default font for the set size (for the `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()`, `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#LARGE_SIZE()` and `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/ButtonDefaults#EXTRA_LARGE_SIZE()` is `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Typography#TYPOGRAPHY_TITLE2()`, `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Typography#TYPOGRAPHY_TITLE1()` and `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Typography#TYPOGRAPHY_DISPLAY3()` respectively). Any previously added content will be overridden. Text should contain no more than 3 characters, otherwise it will overflow from the edges.

### setTextContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
fun [setTextContent](https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String,int))(text: String, typographyName: Int): Button.Builder
```

> [!CAUTION]
> **This function is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given text with the given font. If you need more font related customization, consider using `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Button.Builder#setCustomContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement)` with `https://developer.android.com/reference/kotlin/androidx/wear/tiles/material/Text` component. Any previously added content will be overridden. Text should contain no more than 3 characters, otherwise it will overflow from the edges.