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

*** ** * ** ***


```
public final class SubtitleStyle.Builder
```

<br />

*** ** * ** ***

A builder for `SubtitleStyle` instances.

## Summary

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

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

## Public constructors

### Builder

```
public Builder()
```

Creates an instance with default initial values.

## Public methods

### build

```
public SubtitleStyle build()
```

Builds a `SubtitleStyle` instance.

### setBackgroundColor

```
@CanIgnoreReturnValue
public SubtitleStyle.Builder setBackgroundColor(@ColorInt int backgroundColor)
```

Sets the preferred background color.

The default is `BLACK`.

| Parameters |
|---|---|
| `@ColorInt int backgroundColor` | See `backgroundColor`. |

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

### setEdgeColor

```
@CanIgnoreReturnValue
public SubtitleStyle.Builder setEdgeColor(@ColorInt int edgeColor)
```

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

The default is `WHITE`.

| Parameters |
|---|---|
| `@ColorInt int edgeColor` | See `edgeColor`. |

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

### setEdgeType

```
@CanIgnoreReturnValue
public SubtitleStyle.Builder setEdgeType(@SubtitleStyle.EdgeType int edgeType)
```

Sets the preferred edge type.

The default is `EDGE_TYPE_NONE`.

| Parameters |
|---|---|
| `@SubtitleStyle.EdgeType int edgeType` | See `edgeType`. |

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

### setForegroundColor

```
@CanIgnoreReturnValue
public SubtitleStyle.Builder setForegroundColor(@ColorInt int foregroundColor)
```

Sets the preferred foreground color.

The default is `WHITE`.

| Parameters |
|---|---|
| `@ColorInt int foregroundColor` | See `foregroundColor`. |

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

### setTypeface

```
@CanIgnoreReturnValue
public SubtitleStyle.Builder setTypeface(@Nullable Typeface typeface)
```

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

The default is `null`.

| Parameters |
|---|---|
| `@Nullable Typeface typeface` | See `typeface`. |

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

### setWindowColor

```
@CanIgnoreReturnValue
public SubtitleStyle.Builder setWindowColor(@ColorInt int windowColor)
```

Sets the preferred window color.

The default is `TRANSPARENT`.

| Parameters |
|---|---|
| `@ColorInt int windowColor` | See `windowColor`. |

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