core-ktx / androidx.text / android.text.SpannableStringBuilder

Extensions for android.text.SpannableStringBuilder

backgroundColor

fun SpannableStringBuilder.backgroundColor(color: Int, builderAction: SpannableStringBuilder.() -> Unit): SpannableStringBuilder

Wrap appended text in builderAction in a BackgroundColorSpan.

bold

fun SpannableStringBuilder.bold(builderAction: SpannableStringBuilder.() -> Unit): SpannableStringBuilder

Wrap appended text in builderAction in a bold StyleSpan.

color

fun SpannableStringBuilder.color(color: Int, builderAction: SpannableStringBuilder.() -> Unit): SpannableStringBuilder

Wrap appended text in builderAction in a ForegroundColorSpan.

inSpans

fun SpannableStringBuilder.inSpans(vararg spans: Any, builderAction: SpannableStringBuilder.() -> Unit): SpannableStringBuilder

Wrap appended text in builderAction in spans.

fun SpannableStringBuilder.inSpans(span: Any, builderAction: SpannableStringBuilder.() -> Unit): SpannableStringBuilder

Wrap appended text in builderAction in span.

italic

fun SpannableStringBuilder.italic(builderAction: SpannableStringBuilder.() -> Unit): SpannableStringBuilder

Wrap appended text in builderAction in an italic StyleSpan.

scale

fun SpannableStringBuilder.scale(proportion: Float, builderAction: SpannableStringBuilder.() -> Unit): SpannableStringBuilder

Wrap appended text in builderAction in a RelativeSizeSpan.

strikeThrough

fun SpannableStringBuilder.strikeThrough(builderAction: SpannableStringBuilder.() -> Unit): SpannableStringBuilder

Wrap appended text in builderAction in a StrikethroughSpan.

underline

fun SpannableStringBuilder.underline(builderAction: SpannableStringBuilder.() -> Unit): SpannableStringBuilder

Wrap appended text in builderAction in an UnderlineSpan.