# TypeBuilders.StringLayoutConstraint.Builder

# TypeBuilders.StringLayoutConstraint.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/TypeBuilders.java+class:androidx.wear.protolayout.TypeBuilders.StringLayoutConstraint.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/TypeBuilders.StringLayoutConstraint.Builder "View this page in Java")

<br />

```
class TypeBuilders.StringLayoutConstraint.Builder
```

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                                                                                                                                                                                       ### Public constructors                                                                                                                                                                                                                                                                                       |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[RequiresSchemaVersion](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion)`(major = 1, minor = 200)` [Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringLayoutConstraint.Builder#Builder(java.lang.String))`(patternForLayout: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` Creates a new builder for[StringLayoutConstraint](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringLayoutConstraint). |

|                                                                        ### Public functions                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [TypeBuilders.StringLayoutConstraint](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringLayoutConstraint)                 | [build](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringLayoutConstraint.Builder#build())`()` Builds an instance of[StringLayoutConstraint](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringLayoutConstraint).                                                                                                                                                                                              |
| [TypeBuilders.StringLayoutConstraint.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringLayoutConstraint.Builder) | `@`[RequiresSchemaVersion](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion)`(major = 1, minor = 200)` [setAlignment](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringLayoutConstraint.Builder#setAlignment(int))`(alignment: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets alignment of the actual text within the space reserved by patternForLayout. |

## Public constructors

### Builder

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

```
@RequiresSchemaVersion(major = 1, minor = 200)
Builder(patternForLayout: String)
```

Creates a new builder for[StringLayoutConstraint](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringLayoutConstraint).  

|                                              Parameters                                               |
|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `patternForLayout: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | Sets the text string to use as the pattern for the largest text that can be laid out. Used to ensure that the layout is of a known size during the layout pass. |

## Public functions

### build

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

```
fun build(): TypeBuilders.StringLayoutConstraint
```

Builds an instance of[StringLayoutConstraint](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringLayoutConstraint).  

### setAlignment

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

```
@RequiresSchemaVersion(major = 1, minor = 200)
fun setAlignment(alignment: Int): TypeBuilders.StringLayoutConstraint.Builder
```

Sets alignment of the actual text within the space reserved by patternForLayout. If not specified, defaults to center alignment.