> Documentation index: https://developer.android.com/reference/llms.txt

# SubtitleStyle.Builder

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/text/SubtitleStyle.java+class:androidx.media3.common.text.SubtitleStyle.Builder)

*** ** * ** ***


```
class SubtitleStyle.Builder
```

<br />

*** ** * ** ***

A builder for `SubtitleStyle` instances.

## Summary

| ### Public constructors |
|---|
| `Builder()` Creates an instance with default initial values. |

| ### Public functions |
|---|---|
| `SubtitleStyle!` | `build()` Builds a `SubtitleStyle` instance. |
| `SubtitleStyle.Builder!` | `@CanIgnoreReturnValue setBackgroundColor(backgroundColor: @ColorInt Int)` Sets the preferred background color. |
| `SubtitleStyle.Builder!` | `@CanIgnoreReturnValue setEdgeColor(edgeColor: @ColorInt Int)` Sets the preferred edge color, if using an edge type other than `EDGE_TYPE_NONE`. |
| `SubtitleStyle.Builder!` | `@CanIgnoreReturnValue setEdgeType(@SubtitleStyle.EdgeType edgeType: Int)` Sets the preferred edge type. |
| `SubtitleStyle.Builder!` | `@CanIgnoreReturnValue setForegroundColor(foregroundColor: @ColorInt Int)` Sets the preferred foreground color. |
| `SubtitleStyle.Builder!` | `@CanIgnoreReturnValue setTypeface(typeface: Typeface?)` Sets the preferred typeface, or `null` if unspecified. |
| `SubtitleStyle.Builder!` | `@CanIgnoreReturnValue setWindowColor(windowColor: @ColorInt Int)` Sets the preferred window color. |

## Public constructors

### Builder

```
Builder()
```

Creates an instance with default initial values.

## Public functions

### build

```
fun build(): SubtitleStyle!
```

Builds a `SubtitleStyle` instance.

### setBackgroundColor

```
@CanIgnoreReturnValue
fun setBackgroundColor(backgroundColor: @ColorInt Int): SubtitleStyle.Builder!
```

Sets the preferred background color.

The default is `BLACK`.

| Parameters |
|---|---|
| `backgroundColor: @ColorInt Int` | See `backgroundColor`. |

| Returns |
|---|---|
| `SubtitleStyle.Builder!` | This builder. |

### setEdgeColor

```
@CanIgnoreReturnValue
fun setEdgeColor(edgeColor: @ColorInt Int): SubtitleStyle.Builder!
```

Sets the preferred edge color, if using an edge type other than `EDGE_TYPE_NONE`.

The default is `WHITE`.

| Parameters |
|---|---|
| `edgeColor: @ColorInt Int` | See `edgeColor`. |

| Returns |
|---|---|
| `SubtitleStyle.Builder!` | This builder. |

### setEdgeType

```
@CanIgnoreReturnValue
fun setEdgeType(@SubtitleStyle.EdgeType edgeType: Int): SubtitleStyle.Builder!
```

Sets the preferred edge type.

The default is `EDGE_TYPE_NONE`.

| Parameters |
|---|---|
| `@SubtitleStyle.EdgeType edgeType: Int` | See `edgeType`. |

| Returns |
|---|---|
| `SubtitleStyle.Builder!` | This builder. |

### setForegroundColor

```
@CanIgnoreReturnValue
fun setForegroundColor(foregroundColor: @ColorInt Int): SubtitleStyle.Builder!
```

Sets the preferred foreground color.

The default is `WHITE`.

| Parameters |
|---|---|
| `foregroundColor: @ColorInt Int` | See `foregroundColor`. |

| Returns |
|---|---|
| `SubtitleStyle.Builder!` | This builder. |

### setTypeface

```
@CanIgnoreReturnValue
fun setTypeface(typeface: Typeface?): SubtitleStyle.Builder!
```

Sets the preferred typeface, or `null` if unspecified.

The default is `null`.

| Parameters |
|---|---|
| `typeface: Typeface?` | See `typeface`. |

| Returns |
|---|---|
| `SubtitleStyle.Builder!` | This builder. |

### setWindowColor

```
@CanIgnoreReturnValue
fun setWindowColor(windowColor: @ColorInt Int): SubtitleStyle.Builder!
```

Sets the preferred window color.

The default is `TRANSPARENT`.

| Parameters |
|---|---|
| `windowColor: @ColorInt Int` | See `windowColor`. |

| Returns |
|---|---|
| `SubtitleStyle.Builder!` | This builder. |