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

*** ** * ** ***


```
public final class TextViewStyle.Builder
```

<br />

*** ** * ** ***

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

## Summary

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

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle` | `https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle.Builder#build()()` Returns a subclass of `https://developer.android.com/reference/androidx/autofill/inline/common/BundledStyle` built by this builder. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle.Builder` | `https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle.Builder#setTextColor(int)(@https://developer.android.com/reference/androidx/annotation/ColorInt int textColor)` Specifies the text color. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle.Builder` | `https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle.Builder#setTextSize(float)(float textSize)` Specifies the text size, in sp. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle.Builder` | `https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle.Builder#setTextSize(int,float)(int unit, float size)` Specifies the text size in the provided unit. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle.Builder` | `https://developer.android.com/reference/androidx/autofill/inline/common/TextViewStyle.Builder#setTypeface(java.lang.String,int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html fontFamily, int fontStyle)` 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)

```
public Builder()
```

## Public methods

### build

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

```
public @NonNull TextViewStyle build()
```

Returns a subclass of `https://developer.android.com/reference/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)

```
public @NonNull TextViewStyle.Builder setTextColor(@ColorInt int textColor)
```

Specifies the text color.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/ColorInt int textColor` | 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)

```
public @NonNull TextViewStyle.Builder setTextSize(float textSize)
```

Specifies the text size, in sp.

| Parameters |
|---|---|
| `float textSize` | 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)

```
public @NonNull TextViewStyle.Builder setTextSize(int unit, float size)
```

Specifies the text size in the provided unit.

| Parameters |
|---|---|
| `int unit` | The desired dimension unit. |
| `float size` | 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)

```
public @NonNull TextViewStyle.Builder setTypeface(@NonNull String fontFamily, int fontStyle)
```

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 |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html fontFamily` | the font family for the type face |
| `int fontStyle` | 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)` |   |