{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

Placeholder

public final class Placeholder


A placeholder is a rectangle box inserted into text, which tells the text processor to leave an empty space. It is typically used to insert inline image, custom emoji, etc into the text paragraph.

Throws
kotlin.IllegalArgumentException

if TextUnit.Unspecified is passed to width or height.

Summary

Public constructors

Placeholder(
    @NonNull TextUnit width,
    @NonNull TextUnit height,
    @NonNull PlaceholderVerticalAlign placeholderVerticalAlign
)

Public methods

final @NonNull Placeholder
copy(
    @NonNull TextUnit width,
    @NonNull TextUnit height,
    @NonNull PlaceholderVerticalAlign placeholderVerticalAlign
)
boolean
equals(Object other)
final @NonNull TextUnit

the height of the placeholder, it must be specified in sp or em.

final @NonNull PlaceholderVerticalAlign

the vertical alignment of the placeholder within the text line.

final @NonNull TextUnit

the width of the placeholder, it must be specified in sp or em.

int
@NonNull String

Public constructors

Placeholder

public Placeholder(
    @NonNull TextUnit width,
    @NonNull TextUnit height,
    @NonNull PlaceholderVerticalAlign placeholderVerticalAlign
)
Parameters
@NonNull TextUnit width

the width of the placeholder, it must be specified in sp or em. TextUnit.Unspecified is not allowed.

@NonNull TextUnit height

the height of the placeholder, it must be specified in sp or em. TextUnit.Unspecified is not allowed.

@NonNull PlaceholderVerticalAlign placeholderVerticalAlign

the vertical alignment of the placeholder within the text line. Check PlaceholderVerticalAlign for more information.

Public methods

copy

public final @NonNull Placeholder copy(
    @NonNull TextUnit width,
    @NonNull TextUnit height,
    @NonNull PlaceholderVerticalAlign placeholderVerticalAlign
)

equals

public boolean equals(Object other)

getHeight

public final @NonNull TextUnit getHeight()

the height of the placeholder, it must be specified in sp or em. TextUnit.Unspecified is not allowed.

getPlaceholderVerticalAlign

public final @NonNull PlaceholderVerticalAlign getPlaceholderVerticalAlign()

the vertical alignment of the placeholder within the text line. Check PlaceholderVerticalAlign for more information.

getWidth

public final @NonNull TextUnit getWidth()

the width of the placeholder, it must be specified in sp or em. TextUnit.Unspecified is not allowed.

hashCode

public int hashCode()

toString

public @NonNull String toString()