LayoutElementBuilders.Spannable.Builder


class LayoutElementBuilders.Spannable.Builder


Builder for Spannable.

Summary

Public constructors

Creates an instance of Builder.

Public functions

LayoutElementBuilders.Spannable.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
addSpan(span: LayoutElementBuilders.Span)

Adds one item to the Span elements that form this Spannable.

LayoutElementBuilders.Spannable

Builds an instance with values accumulated in this Builder.

LayoutElementBuilders.Spannable.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setLineHeight(lineHeight: DimensionBuilders.SpProp)

Sets the explicit height between lines of text.

LayoutElementBuilders.Spannable.Builder
@RequiresSchemaVersion(major = 1, minor = 200)
@ProtoLayoutExperimental
setMarqueeIterations(marqueeIterations: @IntRange(from = "-1") Int)

Sets the number of times to repeat the Marquee animation.

LayoutElementBuilders.Spannable.Builder
setMaxLines(maxLines: @IntRange(from = 1) Int)

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

LayoutElementBuilders.Spannable.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setMaxLines(maxLines: TypeBuilders.Int32Prop)

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

LayoutElementBuilders.Spannable.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setModifiers(modifiers: ModifiersBuilders.Modifiers)

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

LayoutElementBuilders.Spannable.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setMultilineAlignment(multilineAlignment: Int)

Sets alignment of the Spannable content within its bounds.

LayoutElementBuilders.Spannable.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setMultilineAlignment(
    multilineAlignment: LayoutElementBuilders.HorizontalAlignmentProp
)

Sets alignment of the Spannable content within its bounds.

LayoutElementBuilders.Spannable.Builder
@RequiresSchemaVersion(major = 1, minor = 0)
setOverflow(overflow: Int)

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

LayoutElementBuilders.Spannable.Builder

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

Public constructors

Builder

Added in 1.0.0
Builder()

Creates an instance of Builder.

Public functions

addSpan

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun addSpan(span: LayoutElementBuilders.Span): LayoutElementBuilders.Spannable.Builder

Adds one item to the Span elements that form this Spannable.

build

Added in 1.0.0
fun build(): LayoutElementBuilders.Spannable

Builds an instance with values accumulated in this Builder.

setLineHeight

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setLineHeight(lineHeight: DimensionBuilders.SpProp): LayoutElementBuilders.Spannable.Builder

Sets 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.

setMarqueeIterations

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 200)
@ProtoLayoutExperimental
fun setMarqueeIterations(marqueeIterations: @IntRange(from = "-1") Int): LayoutElementBuilders.Spannable.Builder

Sets 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.

setMaxLines

Added in 1.0.0
fun setMaxLines(maxLines: @IntRange(from = 1) Int): LayoutElementBuilders.Spannable.Builder

Sets 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.

setMaxLines

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setMaxLines(maxLines: TypeBuilders.Int32Prop): LayoutElementBuilders.Spannable.Builder

Sets 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.

setMultilineAlignment

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setMultilineAlignment(multilineAlignment: Int): LayoutElementBuilders.Spannable.Builder

Sets 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.

setMultilineAlignment

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setMultilineAlignment(
    multilineAlignment: LayoutElementBuilders.HorizontalAlignmentProp
): LayoutElementBuilders.Spannable.Builder

Sets 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.

setOverflow

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setOverflow(overflow: Int): LayoutElementBuilders.Spannable.Builder

Sets 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.

setOverflow

Added in 1.0.0
@RequiresSchemaVersion(major = 1, minor = 0)
fun setOverflow(overflow: LayoutElementBuilders.TextOverflowProp): LayoutElementBuilders.Spannable.Builder

Sets 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.