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

*** ** * ** ***


```
@CarProtocol
public class CarSpan extends CharacterStyle
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.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/androidx/car/app/model/CarSpan) |

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

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

*** ** * ** ***

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

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/car/app/model/CarText` |   |

## Summary

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

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/car/app/model/CarSpan#updateDrawState(android.text.TextPaint)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/text/TextPaint.html tp)` |

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

## Public constructors

### CarSpan

Added in 1.0.0

```
public CarSpan()
```

## Public methods

### updateDrawState

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

```
public void updateDrawState(@NonNull TextPaint tp)
```