# CarSpan

# CarSpan

Artifact:[androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app)  
[View Source](https://cs.android.com/search?q=file:androidx/car/app/model/CarSpan.java+class:androidx.car.app.model.CarSpan)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/car/app/model/CarSpan "View this page in Java")

<br />

```
@CarProtocol
class CarSpan : CharacterStyle
```

<br />

|---|---|-----------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                    |||
| ↳ | [android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html) ||
|   | ↳ | [androidx.car.app.model.CarSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarSpan) |

Known direct subclasses  
[CarIconSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIconSpan),[ClickableSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/ClickableSpan),[DistanceSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/DistanceSpan),[DurationSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/DurationSpan),[ForegroundCarColorSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/ForegroundCarColorSpan)  

|------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [CarIconSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIconSpan)                       | A span that replaces the text it is attached to with a[CarIcon](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon)that is aligned with the surrounding text. |
| [ClickableSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/ClickableSpan)                   | A span that makes a section of text clickable.                                                                                                                                           |
| [DistanceSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/DistanceSpan)                     | A span that replaces the text it is attached to with the string representation of a[Distance](https://developer.android.com/reference/kotlin/androidx/car/app/model/Distance)instance.   |
| [DurationSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/DurationSpan)                     | A span that replaces the text it is attached to with a localized duration string.                                                                                                        |
| [ForegroundCarColorSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/ForegroundCarColorSpan) | A span that changes the color of the text to which the span is attached.                                                                                                                 |

*** ** * ** ***

Base class for all span types allowed for a car app.  

|                                         See also                                         |
|------------------------------------------------------------------------------------------|---|
| [CarText](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText) |   |

## Summary

|                                        ### Public constructors                                         |
|--------------------------------------------------------------------------------------------------------|
| [CarSpan](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarSpan#CarSpan())`()` |

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [updateDrawState](https://developer.android.com/reference/kotlin/androidx/car/app/model/CarSpan#updateDrawState(android.text.TextPaint))`(tp: `[TextPaint](https://developer.android.com/reference/android/text/TextPaint.html)`)` |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html) |-------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html)`!`               | [getUnderlying](https://developer.android.com/reference/android/text/style/CharacterStyle.html#getUnderlying())`()`                                                                                                                       | | `java-static `[CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html)`!` | [wrap](https://developer.android.com/reference/android/text/style/CharacterStyle.html#wrap(android.text.style.CharacterStyle))`(cs: `[CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html)`!)` | |

## Public constructors

### CarSpan

Added in 1.0.0  

```
CarSpan()
```  

## Public functions

### updateDrawState

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)  

```
fun updateDrawState(tp: TextPaint): Unit
```