# CaptionStyleCompat

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/ui/CaptionStyleCompat "View this page in Java")

<br />

```
@UnstableApi
class CaptionStyleCompat
```

<br />

*** ** * ** ***

A compatibility wrapper for[CaptionStyle](https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html).

## Summary

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

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

|                                                                                                                                                                                                                                                                                                                                                                                                                                               ### Public constructors                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [CaptionStyleCompat](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#CaptionStyleCompat(int,int,int,int,int,android.graphics.Typeface))`(` ` foregroundColor: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` backgroundColor: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` windowColor: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` @`[CaptionStyleCompat.EdgeType](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat.EdgeType)` edgeType: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` edgeColor: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` typeface: `[Typeface](https://developer.android.com/reference/android/graphics/Typeface.html)`?` `)` |

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

|                                 ### Public properties                                 |
|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)           | [backgroundColor](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#backgroundColor()) The preferred background color.                                                                                                                                        |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)           | [edgeColor](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#edgeColor()) The preferred edge color, if using an edge type other than[EDGE_TYPE_NONE](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#EDGE_TYPE_NONE()). |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)           | `@`[CaptionStyleCompat.EdgeType](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat.EdgeType) [edgeType](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#edgeType()) The preferred edge type.                             |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)           | [foregroundColor](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#foregroundColor()) The preferred foreground color.                                                                                                                                        |
| [Typeface](https://developer.android.com/reference/android/graphics/Typeface.html)`?` | [typeface](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#typeface()) The preferred typeface, or`null`if unspecified.                                                                                                                                      |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)           | [windowColor](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#windowColor()) The preferred window color.                                                                                                                                                    |

## Constants

### DEFAULT

```
const val DEFAULT: CaptionStyleCompat!
```

Default caption style.  

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

### USE_TRACK_COLOR_SETTINGS

```
const val USE_TRACK_COLOR_SETTINGS = 1: Int
```

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

## Public constructors

### CaptionStyleCompat

```
CaptionStyleCompat(
    foregroundColor: Int,
    backgroundColor: Int,
    windowColor: Int,
    @CaptionStyleCompat.EdgeType edgeType: Int,
    edgeColor: Int,
    typeface: Typeface?
)
```  

|                                                                                                       Parameters                                                                                                        |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| `foregroundColor: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                          | See[foregroundColor](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#foregroundColor()). |
| `backgroundColor: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                          | See[backgroundColor](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#backgroundColor()). |
| `windowColor: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                              | See[windowColor](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#windowColor()).         |
| `@`[CaptionStyleCompat.EdgeType](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat.EdgeType)` edgeType: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | See[edgeType](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#edgeType()).               |
| `edgeColor: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                | See[edgeColor](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#edgeColor()).             |
| `typeface: `[Typeface](https://developer.android.com/reference/android/graphics/Typeface.html)`?`                                                                                                                       | See[typeface](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat#typeface()).               |

## Public functions

### createFromCaptionStyle

```
java-static fun createFromCaptionStyle(captionStyle: CaptioningManager.CaptionStyle!): CaptionStyleCompat!
```

Creates a[CaptionStyleCompat](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat)equivalent to a provided[CaptionStyle](https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html).  

|                                                                         Parameters                                                                          |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| `captionStyle: `[CaptioningManager.CaptionStyle](https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html)`!` | A[CaptionStyle](https://developer.android.com/reference/android/view/accessibility/CaptioningManager.CaptionStyle.html). |

|                                                    Returns                                                    |
|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| [CaptionStyleCompat](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat)`!` | The equivalent[CaptionStyleCompat](https://developer.android.com/reference/kotlin/androidx/media3/ui/CaptionStyleCompat). |

## Public properties

### backgroundColor

```
val backgroundColor: Int
```

The preferred background color.  

### edgeColor

```
val edgeColor: Int
```

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

### edgeType

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

The preferred edge type. One of:

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

### foregroundColor

```
val foregroundColor: Int
```

The preferred foreground color.  

### typeface

```
val typeface: Typeface?
```

The preferred typeface, or`null`if unspecified.  

### windowColor

```
val windowColor: Int
```

The preferred window color.