# MultiButtonLayout.Builder

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

*** ** * ** ***

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

<br />

```
class MultiButtonLayout.Builder
```

<br />

*** ** * ** ***

Builder class for[MultiButtonLayout](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/layouts/MultiButtonLayout).

## Summary

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

|                                                               ### Public functions                                                               |
|--------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [MultiButtonLayout.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder) | [addButtonContent](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder#addButtonContent(androidx.wear.protolayout.LayoutElementBuilders.LayoutElement))`(buttonContent: `[LayoutElementBuilders.LayoutElement](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement)`)` Add one new button to the layout. |
| [MultiButtonLayout](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/layouts/MultiButtonLayout)                 | [build](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder#build())`()` Constructs and returns[MultiButtonLayout](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/layouts/MultiButtonLayout)with the provided content and look.                                                                                                |
| [MultiButtonLayout.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder) | [setFiveButtonDistribution](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/layouts/MultiButtonLayout.Builder#setFiveButtonDistribution(int))`(fiveButtonDistribution: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` 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)  

```
Builder()
```

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

## Public functions

### addButtonContent

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

```
fun addButtonContent(buttonContent: LayoutElementBuilders.LayoutElement): MultiButtonLayout.Builder
```

Add one new button to the layout. Note that it is accepted to pass in any[LayoutElement](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement), but it is strongly recommended to add a[Button](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/Button)as the layout is optimized for it. Any button added after[MAX_BUTTONS](https://developer.android.com/reference/kotlin/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)  

```
fun build(): MultiButtonLayout
```

Constructs and returns[MultiButtonLayout](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/layouts/MultiButtonLayout)with the provided content and look.  

|                                                        Throws                                                         |
|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [java.lang.IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException.html) | if no buttons are added or the number of buttons added is larger than[MAX_BUTTONS](https://developer.android.com/reference/kotlin/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)  

```
fun setFiveButtonDistribution(fiveButtonDistribution: Int): MultiButtonLayout.Builder
```

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.