# MultiButtonLayout.Builder

Artifact: [androidx.wear.protolayout:protolayout-material](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/material/layouts/MultiButtonLayout.java+class:androidx.wear.protolayout.material.layouts.MultiButtonLayout.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


```
public final class MultiButtonLayout.Builder
```

<br />

*** ** * ** ***

Builder class for `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder#Builder()()` Creates a builder for the `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout`. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder#addButtonContent(androidx.wear.protolayout.LayoutElementBuilders.LayoutElement)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement buttonContent )` Add one new button to the layout. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder#build()()` Constructs and returns `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout` with the provided content and look. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder#setFiveButtonDistribution(int)(int fiveButtonDistribution)` Sets the button distribution for this layout. |

## Public constructors

### Builder

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

```
public Builder()
```

Creates a builder for the `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout`. Content inside of it can later be added with `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder#addButtonContent(androidx.wear.protolayout.LayoutElementBuilders.LayoutElement)`.

## Public methods

### addButtonContent

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

```
public @NonNull MultiButtonLayout.Builder addButtonContent(
    @NonNull LayoutElementBuilders.LayoutElement buttonContent
)
```

Add one new button to the layout. Note that it is accepted to pass in any `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement`, but it is strongly recommended to add a `https://developer.android.com/reference/androidx/wear/protolayout/material/Button` as the layout is optimized for it. Any button added after `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/LayoutDefaults.MultiButtonLayoutDefaults#MAX_BUTTONS()` is reached will be discarded.

### build

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

```
public @NonNull MultiButtonLayout build()
```

Constructs and returns `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/MultiButtonLayout` with the provided content and look.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if no buttons are added or the number of buttons added is larger than `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/LayoutDefaults.MultiButtonLayoutDefaults#MAX_BUTTONS()`. |

### setFiveButtonDistribution

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

```
public @NonNull MultiButtonLayout.Builder setFiveButtonDistribution(int fiveButtonDistribution)
```

Sets the button distribution for this layout. Button distribution is used in case when there is 5 buttons in the layout to determine whether the 3 buttons row is at the top or bottom.