LayoutElementBuilders.Spannable

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

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


A container of LayoutElementBuilders.Span elements. Currently, this only supports LayoutElementBuilders.Text elements, where each individual LayoutElementBuilders.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 classes

class LayoutElementBuilders.Spannable.Builder

Builder for LayoutElementBuilders.Spannable

Public methods

static LayoutElementBuilders.Spannable.Builder builder()

Returns a new LayoutElementBuilders.Spannable.Builder.

DimensionBuilders.SpProp getLineSpacing()

Gets extra spacing to add between each line.

TypeBuilders.Int32Prop getMaxLines()

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

ModifiersBuilders.Modifiers getModifiers()

Gets ModifiersBuilders.Modifiers for this element.

LayoutElementBuilders.HorizontalAlignmentProp getMultilineAlignment()

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

LayoutElementBuilders.TextOverflowProp getOverflow()

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

List<LayoutElementBuilders.Span> getSpans()

Gets the LayoutElementBuilders.Span elements that form this LayoutElementBuilders.Spannable.

Inherited methods

Public methods

getLineSpacing

public DimensionBuilders.SpProp getLineSpacing ()

Gets 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. Intended for testing purposes only.

Returns
DimensionBuilders.SpProp

getMaxLines

public TypeBuilders.Int32Prop getMaxLines ()

Gets 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. Intended for testing purposes only.

Returns
TypeBuilders.Int32Prop

getModifiers

public ModifiersBuilders.Modifiers getModifiers ()

Gets ModifiersBuilders.Modifiers for this element. Intended for testing purposes only.

Returns
ModifiersBuilders.Modifiers

getMultilineAlignment

public LayoutElementBuilders.HorizontalAlignmentProp getMultilineAlignment ()

Gets 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. Intended for testing purposes only.

Returns
LayoutElementBuilders.HorizontalAlignmentProp

getOverflow

public LayoutElementBuilders.TextOverflowProp getOverflow ()

Gets 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. Intended for testing purposes only.

Returns
LayoutElementBuilders.TextOverflowProp

getSpans

public List<LayoutElementBuilders.Span> getSpans ()

Gets the LayoutElementBuilders.Span elements that form this LayoutElementBuilders.Spannable. Intended for testing purposes only.

Returns
List<LayoutElementBuilders.Span>