> 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
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 |
|---|
| `class SubtitleStyle.Builder` A builder for `SubtitleStyle` instances. |
| `@Documented @Retention(value = RetentionPolicy.SOURCE) @Target(value = ElementType.TYPE_USE) @IntDef(value = ) annotation SubtitleStyle.EdgeType` The type of edge, which may be none. |

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

| ### Public functions |
|---|---|
| `SubtitleStyle.Builder!` | `buildUpon()` Returns a `Builder` initialized with the values of this instance. |
| `Boolean` | `equals(obj: Any?)` |
| `java-static SubtitleStyle!` | `fromCaptionStyle(captionStyle: CaptioningManager.CaptionStyle!)` Creates a `SubtitleStyle` from a provided `CaptionStyle`. |
| `Int` | `hashCode()` |

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

## Constants

### DEFAULT

```
const val DEFAULT: SubtitleStyle!
```

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

### EDGE_TYPE_DEPRESSED

```
const val EDGE_TYPE_DEPRESSED = 4: Int
```

Edge type value specifying depressed bevel character edges.

### EDGE_TYPE_DROP_SHADOW

```
const val EDGE_TYPE_DROP_SHADOW = 2: Int
```

Edge type value specifying drop-shadowed character edges.

### EDGE_TYPE_NONE

```
const val EDGE_TYPE_NONE = 0: Int
```

Edge type value specifying no character edges.

### EDGE_TYPE_OUTLINE

```
const val EDGE_TYPE_OUTLINE = 1: Int
```

Edge type value specifying uniformly outlined character edges.

### EDGE_TYPE_RAISED

```
const val EDGE_TYPE_RAISED = 3: Int
```

Edge type value specifying raised bevel character edges.

## Public functions

### buildUpon

```
fun buildUpon(): SubtitleStyle.Builder!
```

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

### equals

```
fun equals(obj: Any?): Boolean
```

### fromCaptionStyle

```
java-static fun fromCaptionStyle(captionStyle: CaptioningManager.CaptionStyle!): SubtitleStyle!
```

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

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

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

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

### hashCode

```
fun hashCode(): Int
```

## Public properties

### backgroundColor

```
val backgroundColor: @ColorInt Int
```

The preferred background color.

### edgeColor

```
val edgeColor: @ColorInt Int
```

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

### edgeType

```
@SubtitleStyle.EdgeType
val edgeType: Int
```

The preferred edge type. One of:

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

### foregroundColor

```
val foregroundColor: @ColorInt Int
```

The preferred foreground color.

### typeface

```
val typeface: Typeface?
```

The preferred typeface, or `null` if unspecified.

### windowColor

```
val windowColor: @ColorInt Int
```

The preferred window color.