LayoutElementBuilders.Spannable.Builder

public final class LayoutElementBuilders.Spannable.Builder implements LayoutElementBuilders.LayoutElement.Builder


Builder for Spannable.

Summary

Public constructors

Public methods

@NonNull LayoutElementBuilders.Spannable.Builder

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

@Override @NonNull LayoutElementBuilders.Spannable

Builds an instance with values accumulated in this Builder.

@NonNull LayoutElementBuilders.Spannable.Builder

Sets the explicit height between lines of text.

@NonNull LayoutElementBuilders.Spannable.Builder

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

@NonNull LayoutElementBuilders.Spannable.Builder
setMaxLines(@IntRange(from = "1") @NonNull int maxLines)

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

@NonNull LayoutElementBuilders.Spannable.Builder

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

@NonNull LayoutElementBuilders.Spannable.Builder

Sets alignment of the Spannable content within its bounds.

@NonNull LayoutElementBuilders.Spannable.Builder

Sets alignment of the Spannable content within its bounds.

@NonNull LayoutElementBuilders.Spannable.Builder

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

@NonNull LayoutElementBuilders.Spannable.Builder

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

Public constructors

Builder

public Builder()

Public methods

addSpan

@NonNull
public LayoutElementBuilders.Spannable.Builder addSpan(@NonNull LayoutElementBuilders.Span span)

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

build

@Override
@NonNull
public @Override LayoutElementBuilders.Spannable build()

Builds an instance with values accumulated in this Builder.

setLineHeight

@NonNull
public LayoutElementBuilders.Spannable.Builder setLineHeight(@NonNull DimensionBuilders.SpProp lineHeight)

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.

setMaxLines

@NonNull
public LayoutElementBuilders.Spannable.Builder setMaxLines(@NonNull TypeBuilders.Int32Prop maxLines)

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

@NonNull
public LayoutElementBuilders.Spannable.Builder setMaxLines(@IntRange(from = "1") @NonNull int maxLines)

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

@NonNull
public LayoutElementBuilders.Spannable.Builder setMultilineAlignment(
    @NonNull LayoutElementBuilders.HorizontalAlignmentProp multilineAlignment
)

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

@NonNull
public LayoutElementBuilders.Spannable.Builder setMultilineAlignment(
    @LayoutElementBuilders.HorizontalAlignment @NonNull int multilineAlignment
)

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

@NonNull
public LayoutElementBuilders.Spannable.Builder setOverflow(@NonNull LayoutElementBuilders.TextOverflowProp overflow)

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

@NonNull
public LayoutElementBuilders.Spannable.Builder setOverflow(@LayoutElementBuilders.TextOverflow @NonNull int overflow)

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.