LayoutElementBuilders.Spannable.Builder

public static final class LayoutElementBuilders.Spannable.Builder
extends Object implements LayoutElementBuilders.LayoutElement.Builder

java.lang.Object
   ↳ androidx.wear.tiles.builders.LayoutElementBuilders.Spannable.Builder


Builder for LayoutElementBuilders.Spannable.

Summary

Public methods

LayoutElementBuilders.Spannable.Builder addSpan(LayoutElementBuilders.Span.Builder spanBuilder)

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

LayoutElementBuilders.Spannable.Builder addSpan(LayoutElementBuilders.Span span)

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

LayoutElementBuilders.Spannable build()

Builds an instance with values accumulated in this Builder.

LayoutElementBuilders.Spannable.Builder setLineSpacing(DimensionBuilders.SpProp.Builder lineSpacingBuilder)

Sets extra spacing to add between each line.

LayoutElementBuilders.Spannable.Builder setLineSpacing(DimensionBuilders.SpProp lineSpacing)

Sets extra spacing to add between each line.

LayoutElementBuilders.Spannable.Builder setMaxLines(int maxLines)

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

LayoutElementBuilders.Spannable.Builder setModifiers(ModifiersBuilders.Modifiers modifiers)

Sets ModifiersBuilders.Modifiers for this element.

LayoutElementBuilders.Spannable.Builder setModifiers(ModifiersBuilders.Modifiers.Builder modifiersBuilder)

Sets ModifiersBuilders.Modifiers for this element.

LayoutElementBuilders.Spannable.Builder setMultilineAlignment(int multilineAlignment)

Sets alignment of the LayoutElementBuilders.Spannable content within its bounds.

LayoutElementBuilders.Spannable.Builder setOverflow(int overflow)

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

Inherited methods

Public methods

addSpan

public LayoutElementBuilders.Spannable.Builder addSpan (LayoutElementBuilders.Span.Builder spanBuilder)

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

Parameters
spanBuilder LayoutElementBuilders.Span.Builder

Returns
LayoutElementBuilders.Spannable.Builder

addSpan

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

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

Parameters
span LayoutElementBuilders.Span

Returns
LayoutElementBuilders.Spannable.Builder

build

public LayoutElementBuilders.Spannable build ()

Builds an instance with values accumulated in this Builder.

Returns
LayoutElementBuilders.Spannable

setLineSpacing

public LayoutElementBuilders.Spannable.Builder setLineSpacing (DimensionBuilders.SpProp.Builder lineSpacingBuilder)

Sets extra spacing to add between each line. This will apply to all spans regardless of their font size. This is in addition to original line heights. Note that this won't add any additional space before the first line or after the last line. The default value is zero and negative values will decrease the interline spacing.

Parameters
lineSpacingBuilder DimensionBuilders.SpProp.Builder

Returns
LayoutElementBuilders.Spannable.Builder

setLineSpacing

public LayoutElementBuilders.Spannable.Builder setLineSpacing (DimensionBuilders.SpProp lineSpacing)

Sets extra spacing to add between each line. This will apply to all spans regardless of their font size. This is in addition to original line heights. Note that this won't add any additional space before the first line or after the last line. The default value is zero and negative values will decrease the interline spacing.

Parameters
lineSpacing DimensionBuilders.SpProp

Returns
LayoutElementBuilders.Spannable.Builder

setMaxLines

public LayoutElementBuilders.Spannable.Builder setMaxLines (int maxLines)

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

Parameters
maxLines int

Value is 1 or greater.

Returns
LayoutElementBuilders.Spannable.Builder

setModifiers

public LayoutElementBuilders.Spannable.Builder setModifiers (ModifiersBuilders.Modifiers modifiers)

Sets ModifiersBuilders.Modifiers for this element.

Parameters
modifiers ModifiersBuilders.Modifiers

Returns
LayoutElementBuilders.Spannable.Builder

setModifiers

public LayoutElementBuilders.Spannable.Builder setModifiers (ModifiersBuilders.Modifiers.Builder modifiersBuilder)

Sets ModifiersBuilders.Modifiers for this element.

Parameters
modifiersBuilder ModifiersBuilders.Modifiers.Builder

Returns
LayoutElementBuilders.Spannable.Builder

setMultilineAlignment

public LayoutElementBuilders.Spannable.Builder setMultilineAlignment (int multilineAlignment)

Sets alignment of the LayoutElementBuilders.Spannable content within its bounds. Note that a LayoutElementBuilders.Spannable 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 LayoutElementBuilders.Spannable element bounds. If not defined, defaults to TEXT_ALIGN_CENTER.

Parameters
multilineAlignment int

Returns
LayoutElementBuilders.Spannable.Builder

setOverflow

public LayoutElementBuilders.Spannable.Builder setOverflow (int overflow)

Sets how to handle content which overflows the bound of the LayoutElementBuilders.Spannable element. A LayoutElementBuilders.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.

Parameters
overflow int

Returns
LayoutElementBuilders.Spannable.Builder