# CaptionStyleCompat

Artifact: [androidx.media3:media3-ui](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/ui/CaptionStyleCompat.java+class:androidx.media3.ui.CaptionStyleCompat)

*** ** * ** ***


```
@UnstableApi
public final class CaptionStyleCompat
```

<br />

*** ** * ** ***

A compatibility wrapper for `https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html`.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat.EdgeType` The type of edge, which may be none. |

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#DEFAULT()` Default caption style. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_DEPRESSED() = 4` Edge type value specifying depressed bevel character edges. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_DROP_SHADOW() = 2` Edge type value specifying drop-shadowed character edges. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_NONE() = 0` Edge type value specifying no character edges. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_OUTLINE() = 1` Edge type value specifying uniformly outlined character edges. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_RAISED() = 3` Edge type value specifying raised bevel character edges. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#USE_TRACK_COLOR_SETTINGS() = 1` Use color setting specified by the track and fallback to default caption style. |

| ### Public fields |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#backgroundColor()` The preferred background color. |
| `final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#edgeColor()` The preferred edge color, if using an edge type other than `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_NONE()`. |
| `final int` | `@https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat.EdgeType https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#edgeType()` The preferred edge type. |
| `final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#foregroundColor()` The preferred foreground color. |
| `final @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/Typeface.html` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#typeface()` The preferred typeface, or `null` if unspecified. |
| `final int` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#windowColor()` The preferred window color. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#CaptionStyleCompat(int,int,int,int,int,android.graphics.Typeface)( int foregroundColor, int backgroundColor, int windowColor, @https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat.EdgeType int edgeType, int edgeColor, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/Typeface.html typeface )` |

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat` | `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#createFromCaptionStyle(android.view.accessibility.CaptioningManager.CaptionStyle)(https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html captionStyle)` Creates a `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat` equivalent to a provided `https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html`. |

## Constants

### DEFAULT

```
public static final CaptionStyleCompat DEFAULT
```

Default caption style.

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

### USE_TRACK_COLOR_SETTINGS

```
public static final int USE_TRACK_COLOR_SETTINGS = 1
```

Use color setting specified by the track and fallback to default caption style.

## Public fields

### backgroundColor

```
public final int backgroundColor
```

The preferred background color.

### edgeColor

```
public final int edgeColor
```

The preferred edge color, if using an edge type other than `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_NONE()`.

### edgeType

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

The preferred edge type. One of:

- `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_NONE()`
- `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_OUTLINE()`
- `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_DROP_SHADOW()`
- `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_RAISED()`
- `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_DEPRESSED()`

### foregroundColor

```
public final int foregroundColor
```

The preferred foreground color.

### typeface

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

The preferred typeface, or `null` if unspecified.

### windowColor

```
public final int windowColor
```

The preferred window color.

## Public constructors

### CaptionStyleCompat

```
public CaptionStyleCompat(
    int foregroundColor,
    int backgroundColor,
    int windowColor,
    @CaptionStyleCompat.EdgeType int edgeType,
    int edgeColor,
    @Nullable Typeface typeface
)
```

| Parameters |
|---|---|
| `int foregroundColor` | See `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#foregroundColor()`. |
| `int backgroundColor` | See `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#backgroundColor()`. |
| `int windowColor` | See `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#windowColor()`. |
| `@https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat.EdgeType int edgeType` | See `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#edgeType()`. |
| `int edgeColor` | See `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#edgeColor()`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/graphics/Typeface.html typeface` | See `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat#typeface()`. |

## Public methods

### createFromCaptionStyle

```
public static CaptionStyleCompat createFromCaptionStyle(CaptioningManager.CaptionStyle captionStyle)
```

Creates a `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat` equivalent to a provided `https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html captionStyle` | A `https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat` | The equivalent `https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat`. |