LayoutElementBuilders.Text.Builder

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

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


Builder for LayoutElementBuilders.Text.

Summary

Public methods

LayoutElementBuilders.Text build()

Builds an instance with values accumulated in this Builder.

LayoutElementBuilders.Text.Builder setFontStyle(LayoutElementBuilders.FontStyle fontStyle)

Sets the style of font to use (size, bold etc).

LayoutElementBuilders.Text.Builder setFontStyle(LayoutElementBuilders.FontStyle.Builder fontStyleBuilder)

Sets the style of font to use (size, bold etc).

LayoutElementBuilders.Text.Builder setLineHeight(DimensionBuilders.SpProp.Builder lineHeightBuilder)

Sets the explicit height between lines of text.

LayoutElementBuilders.Text.Builder setLineHeight(DimensionBuilders.SpProp lineHeight)

Sets the explicit height between lines of text.

LayoutElementBuilders.Text.Builder setMaxLines(int maxLines)

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

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

Sets ModifiersBuilders.Modifiers for this element.

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

Sets ModifiersBuilders.Modifiers for this element.

LayoutElementBuilders.Text.Builder setMultilineAlignment(int multilineAlignment)

Sets alignment of the text within its bounds.

LayoutElementBuilders.Text.Builder setOverflow(int overflow)

Sets how to handle text which overflows the bound of the LayoutElementBuilders.Text element.

LayoutElementBuilders.Text.Builder setText(String text)

Sets the text to render.

Inherited methods

Public methods

build

public LayoutElementBuilders.Text build ()

Builds an instance with values accumulated in this Builder.

Returns
LayoutElementBuilders.Text

setFontStyle

public LayoutElementBuilders.Text.Builder setFontStyle (LayoutElementBuilders.FontStyle fontStyle)

Sets the style of font to use (size, bold etc). If not specified, defaults to the platform's default body font.

Parameters
fontStyle LayoutElementBuilders.FontStyle

Returns
LayoutElementBuilders.Text.Builder

setFontStyle

public LayoutElementBuilders.Text.Builder setFontStyle (LayoutElementBuilders.FontStyle.Builder fontStyleBuilder)

Sets the style of font to use (size, bold etc). If not specified, defaults to the platform's default body font.

Parameters
fontStyleBuilder LayoutElementBuilders.FontStyle.Builder

Returns
LayoutElementBuilders.Text.Builder

setLineHeight

public LayoutElementBuilders.Text.Builder setLineHeight (DimensionBuilders.SpProp.Builder lineHeightBuilder)

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.

Parameters
lineHeightBuilder DimensionBuilders.SpProp.Builder

Returns
LayoutElementBuilders.Text.Builder

setLineHeight

public LayoutElementBuilders.Text.Builder setLineHeight (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.

Parameters
lineHeight DimensionBuilders.SpProp

Returns
LayoutElementBuilders.Text.Builder

setMaxLines

public LayoutElementBuilders.Text.Builder setMaxLines (int maxLines)

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

Parameters
maxLines int

Value is 1 or greater.

Returns
LayoutElementBuilders.Text.Builder

setModifiers

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

Sets ModifiersBuilders.Modifiers for this element.

Parameters
modifiers ModifiersBuilders.Modifiers

Returns
LayoutElementBuilders.Text.Builder

setModifiers

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

Sets ModifiersBuilders.Modifiers for this element.

Parameters
modifiersBuilder ModifiersBuilders.Modifiers.Builder

Returns
LayoutElementBuilders.Text.Builder

setMultilineAlignment

public LayoutElementBuilders.Text.Builder setMultilineAlignment (int multilineAlignment)

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

Parameters
multilineAlignment int

Returns
LayoutElementBuilders.Text.Builder

setOverflow

public LayoutElementBuilders.Text.Builder setOverflow (int overflow)

Sets how to handle text which overflows the bound of the LayoutElementBuilders.Text element. A LayoutElementBuilders.Text 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 text, the text which cannot fit inside its container will be truncated. If not defined, defaults to TEXT_OVERFLOW_TRUNCATE.

Parameters
overflow int

Returns
LayoutElementBuilders.Text.Builder

setText

public LayoutElementBuilders.Text.Builder setText (String text)

Sets the text to render.

Parameters
text String

Returns
LayoutElementBuilders.Text.Builder