LayoutElementBuilders.Spannable


@RequiresSchemaVersion(major = 1, minor = 0)
class LayoutElementBuilders.Spannable : LayoutElementBuilders.LayoutElement


A container of Span elements. Currently, this supports SpanImage and elements, where each individual Span can have different styling applied to it but the resulting text will flow naturally. This allows sections of a paragraph of text to have different styling applied to it, for example, making one or two words bold or italic.

Summary

Nested types

Builder for Spannable.

Public functions

DimensionBuilders.SpProp?

Gets the explicit height between lines of text.

@IntRange(from = "-1") Int

Gets the number of times to repeat the Marquee animation.

TypeBuilders.Int32Prop?

Gets the maximum number of lines that can be represented by the Spannable element.

ModifiersBuilders.Modifiers?

Gets androidx.wear.protolayout.ModifiersBuilders.Modifiers for this element.

LayoutElementBuilders.HorizontalAlignmentProp?

Gets alignment of the Spannable content within its bounds.

LayoutElementBuilders.TextOverflowProp?

Gets how to handle content which overflows the bound of the Spannable element.

(Mutable)List<LayoutElementBuilders.Span!>

Gets the Span elements that form this Spannable.

String

Public functions

getLineHeight

Added in 1.0.0
fun getLineHeight(): DimensionBuilders.SpProp?

Gets the explicit height between lines of text. This is equivalent to the vertical distance between subsequent baselines. If not specified, defaults the font's recommended interline spacing.

getMarqueeIterations

Added in 1.0.0
@ProtoLayoutExperimental
fun getMarqueeIterations(): @IntRange(from = "-1") Int

Gets the number of times to repeat the Marquee animation. Only applies when overflow is TEXT_OVERFLOW_MARQUEE. Set to -1 to repeat indefinitely. Defaults to repeat indefinitely.

getMaxLines

Added in 1.0.0
fun getMaxLines(): TypeBuilders.Int32Prop?

Gets the maximum number of lines that can be represented by the Spannable element. If not defined, the Spannable element will be treated as a single-line element.

getMultilineAlignment

Added in 1.0.0
fun getMultilineAlignment(): LayoutElementBuilders.HorizontalAlignmentProp?

Gets alignment of the Spannable content within its bounds. Note that a element will size itself to wrap its contents, so this option is meaningless for single-line content (for that, use alignment of the outer container). For multi-line content, however, this will set the alignment of lines relative to the Spannable element bounds. If not defined, defaults to TEXT_ALIGN_CENTER.

getOverflow

Added in 1.0.0
fun getOverflow(): LayoutElementBuilders.TextOverflowProp?

Gets how to handle content which overflows the bound of the Spannable element. A Spannable element will grow as large as possible inside its parent container (while still respecting max_lines); if it cannot grow large enough to render all of its content, the content which cannot fit inside its container will be truncated. If not defined, defaults to TEXT_OVERFLOW_TRUNCATE.

getSpans

Added in 1.0.0
fun getSpans(): (Mutable)List<LayoutElementBuilders.Span!>

Gets the Span elements that form this Spannable.

toString

fun toString(): String