# TextViewStyle.Builder

Artifact: [androidx.autofill:autofill](https://developer.android.com/jetpack/androidx/releases/autofill) [View Source](https://cs.android.com/search?q=file:androidx/autofill/inline/common/TextViewStyle.java+class:androidx.autofill.inline.common.TextViewStyle.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

*** ** * ** ***


```
class TextViewStyle.Builder
```

<br />

*** ** * ** ***

Builder for the `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder#Builder()()` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle` | `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder#build()()` Returns a subclass of `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/BundledStyle` built by this builder. |
| `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder` | `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder#setTextColor(int)(textColor: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Specifies the text color. |
| `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder` | `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder#setTextSize(float)(textSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Specifies the text size, in sp. |
| `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder` | `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder#setTextSize(int,float)(unit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Specifies the text size in the provided unit. |
| `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder` | `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/TextViewStyle.Builder#setTypeface(java.lang.String,int)(fontFamily: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, fontStyle: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Specifies the text font family and style. |

## Public constructors

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

```
Builder()
```

## Public functions

### build

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

```
fun build(): TextViewStyle
```

Returns a subclass of `https://developer.android.com/reference/kotlin/androidx/autofill/inline/common/BundledStyle` built by this builder.

### setTextColor

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

```
fun setTextColor(textColor: @ColorInt Int): TextViewStyle.Builder
```

Specifies the text color.

| Parameters |
|---|---|
| `textColor: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | A color value in the form 0xAARRGGBB. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/TextView.html#setTextColor(int)` |   |

### setTextSize

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

```
fun setTextSize(textSize: Float): TextViewStyle.Builder
```

Specifies the text size, in sp.

| Parameters |
|---|---|
| `textSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The scaled pixel size. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/TextView.html#setTextSize(float)` |   |

### setTextSize

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

```
fun setTextSize(unit: Int, size: Float): TextViewStyle.Builder
```

Specifies the text size in the provided unit.

| Parameters |
|---|---|
| `unit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The desired dimension unit. |
| `size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The device independent pixel size. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/TextView.html#setTextSize(int, float)` |   |

### setTypeface

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/autofill#1.1.0)

```
fun setTypeface(fontFamily: String, fontStyle: Int): TextViewStyle.Builder
```

Specifies the text font family and style. If the font family can not be found/loaded from the renderer process, it may fallback to the default system font.

| Parameters |
|---|---|
| `fontFamily: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the font family for the type face |
| `fontStyle: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the style for the type face. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/Typeface.html#create(java.lang.String, int)` |   |
| `https://developer.android.com/reference/android/widget/TextView.html#setTypeface(android.graphics.Typeface, int)` |   |