TextAppearanceSpanCompat
class TextAppearanceSpanCompat : MetricAffectingSpan
| kotlin.Any | |||
| ↳ | android.text.style.CharacterStyle | ||
| ↳ | android.text.style.MetricAffectingSpan | ||
| ↳ | androidx.appcompat.text.TextAppearanceSpanCompat |
A TextAppearanceSpan works with Android X Downloadable Font
Summary
Public companion functions |
|
|---|---|
TextAppearanceSpanCompat |
create(Creates a TextAppearanceSpanCompat. |
Public functions |
|
|---|---|
open Unit |
updateDrawState(ds: TextPaint?) |
open Unit |
Inherited properties |
|---|
Public companion functions
create
fun create(
context: Context,
appearance: Int,
colorList: Int,
executor: Executor,
onComplete: Runnable
): TextAppearanceSpanCompat
Creates a TextAppearanceSpanCompat.
The android:fontFamily may need to fetched asynchronously. The returned TextAppearanceSpanCompat may not immediately reflect the custom font, but it will be updated once the font is fetched. The provided callback will not be executed if the asynchronous fetch is not needed.
| Parameters | |
|---|---|
context: Context |
The context to use. |
appearance: Int |
The resource ID of a TextAppearance style. |
colorList: Int |
The resource ID of a ColorStateList. |
executor: Executor |
The executor to use for fetching the font. |
onComplete: Runnable |
A runnable to be executed when the font fetching is complete. This runnable will be executed on the executor's thread. The client is responsible for invalidating the text layout if necessary. |
| Returns | |
|---|---|
TextAppearanceSpanCompat |
A TextAppearanceSpanCompat. |