Android 12 Developer Preview is here! Try it out, and give us your feedback!

TextDecoration

@Immutable class TextDecoration
kotlin.Any
   ↳ androidx.compose.ui.text.style.TextDecoration

Defines a horizontal line to be drawn on the text.

Summary

Public methods
operator Boolean

Check whether this TextDecoration contains the given decoration.

operator Boolean
equals(other: Any?)

Int

operator TextDecoration
plus(decoration: TextDecoration)

Creates a decoration that includes both of the TextDecorations.

String

Companion functions
TextDecoration
combine(decorations: List<TextDecoration>)

Creates a decoration that includes all the given decorations.

Properties
Int

Companion properties
TextDecoration

Draws a horizontal line over the text.

TextDecoration

TextDecoration

Draws a horizontal line below the text.

Public methods

contains

operator fun contains(other: TextDecoration): Boolean

Check whether this TextDecoration contains the given decoration.

Parameters
other: TextDecoration The TextDecoration to be checked.

equals

operator fun equals(other: Any?): Boolean

hashCode

fun hashCode(): Int

plus

operator fun plus(decoration: TextDecoration): TextDecoration

Creates a decoration that includes both of the TextDecorations.

import androidx.compose.material.Text

Text(
    text = "Demo Text",
    textDecoration = TextDecoration.Underline + TextDecoration.LineThrough
)

toString

fun toString(): String

Properties

mask

val mask: Int

Companion functions

combine

fun combine(decorations: List<TextDecoration>): TextDecoration

Creates a decoration that includes all the given decorations.

import androidx.compose.material.Text

Text(
    text = "Demo Text",
    textDecoration = TextDecoration.Underline + TextDecoration.LineThrough
)
Parameters
decorations: List<TextDecoration> The decorations to be added

Companion properties

LineThrough

@Stable val LineThrough: TextDecoration

Draws a horizontal line over the text.

import androidx.compose.material.Text

Text(
    text = "Demo Text",
    textDecoration = TextDecoration.LineThrough
)

None

@Stable val None: TextDecoration

Underline

@Stable val Underline: TextDecoration

Draws a horizontal line below the text.

import androidx.compose.material.Text

Text(
    text = "Demo Text",
    textDecoration = TextDecoration.Underline
)