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

# SubtitleStyle

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)

*** ** * ** ***


```
@UnstableApi
public final class SubtitleStyle
```

<br />

*** ** * ** ***

Styling for subtitles that isn't carried by the media, such as user or app preferences.

An instance can be created from the user's system caption style using `fromCaptionStyle` with `getUserStyle`, or constructed directly with `Builder`.

## Summary

| ### Nested types |
|---|
| `public final class SubtitleStyle.Builder` A builder for `SubtitleStyle` instances. |
| `@Documented @Retention(value = RetentionPolicy.SOURCE) @Target(value = ElementType.TYPE_USE) @IntDef(value = ) public annotation SubtitleStyle.EdgeType` The type of edge, which may be none. |

| ### Constants |
|---|---|
| `static final SubtitleStyle` | `DEFAULT` A `SubtitleStyle` with the default values specified by `Builder`. |
| `static final int` | `EDGE_TYPE_DEPRESSED = 4` Edge type value specifying depressed bevel character edges. |
| `static final int` | `EDGE_TYPE_DROP_SHADOW = 2` Edge type value specifying drop-shadowed character edges. |
| `static final int` | `EDGE_TYPE_NONE = 0` Edge type value specifying no character edges. |
| `static final int` | `EDGE_TYPE_OUTLINE = 1` Edge type value specifying uniformly outlined character edges. |
| `static final int` | `EDGE_TYPE_RAISED = 3` Edge type value specifying raised bevel character edges. |

| ### Public fields |
|---|---|
| `final @ColorInt int` | `backgroundColor` The preferred background color. |
| `final @ColorInt int` | `edgeColor` The preferred edge color, if using an edge type other than `EDGE_TYPE_NONE`. |
| `final int` | `@SubtitleStyle.EdgeType edgeType` The preferred edge type. |
| `final @ColorInt int` | `foregroundColor` The preferred foreground color. |
| `final @Nullable Typeface` | `typeface` The preferred typeface, or `null` if unspecified. |
| `final @ColorInt int` | `windowColor` The preferred window color. |

| ### Public methods |
|---|---|
| `SubtitleStyle.Builder` | `buildUpon()` Returns a `Builder` initialized with the values of this instance. |
| `boolean` | `equals(@Nullable Object obj)` |
| `static SubtitleStyle` | `fromCaptionStyle(CaptioningManager.CaptionStyle captionStyle)` Creates a `SubtitleStyle` from a provided `CaptionStyle`. |
| `int` | `hashCode()` |

## Constants

### DEFAULT

```
public static final SubtitleStyle DEFAULT
```

A `SubtitleStyle` with the default values specified by `Builder`.

### EDGE_TYPE_DEPRESSED

```
public static final int EDGE_TYPE_DEPRESSED = 4
```

Edge type value specifying depressed bevel character edges.

### EDGE_TYPE_DROP_SHADOW

```
public static final int EDGE_TYPE_DROP_SHADOW = 2
```

Edge type value specifying drop-shadowed character edges.

### EDGE_TYPE_NONE

```
public static final int EDGE_TYPE_NONE = 0
```

Edge type value specifying no character edges.

### EDGE_TYPE_OUTLINE

```
public static final int EDGE_TYPE_OUTLINE = 1
```

Edge type value specifying uniformly outlined character edges.

### EDGE_TYPE_RAISED

```
public static final int EDGE_TYPE_RAISED = 3
```

Edge type value specifying raised bevel character edges.

## Public fields

### backgroundColor

```
public final @ColorInt int backgroundColor
```

The preferred background color.

### edgeColor

```
public final @ColorInt int edgeColor
```

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

### edgeType

```
@SubtitleStyle.EdgeType
public final int edgeType
```

The preferred edge type. One of:

- `EDGE_TYPE_NONE`
- `EDGE_TYPE_OUTLINE`
- `EDGE_TYPE_DROP_SHADOW`
- `EDGE_TYPE_RAISED`
- `EDGE_TYPE_DEPRESSED`

### foregroundColor

```
public final @ColorInt int foregroundColor
```

The preferred foreground color.

### typeface

```
public final @Nullable Typeface typeface
```

The preferred typeface, or `null` if unspecified.

### windowColor

```
public final @ColorInt int windowColor
```

The preferred window color.

## Public methods

### buildUpon

```
public SubtitleStyle.Builder buildUpon()
```

Returns a `Builder` initialized with the values of this instance.

### equals

```
public boolean equals(@Nullable Object obj)
```

### fromCaptionStyle

```
public static SubtitleStyle fromCaptionStyle(CaptioningManager.CaptionStyle captionStyle)
```

Creates a `SubtitleStyle` from a provided `CaptionStyle`.

Any properties that aren't set in the `CaptionStyle` are taken from `DEFAULT`.

| Parameters |
|---|---|
| `CaptioningManager.CaptionStyle captionStyle` | A `CaptionStyle`. |

| Returns |
|---|---|
| `SubtitleStyle` | The corresponding `SubtitleStyle`. |

### hashCode

```
public int hashCode()
```