LayoutElementBuilders.Text.Builder

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


Builder for Text.

Summary

Public constructors

Public methods

@Override @NonNull LayoutElementBuilders.Text

Builds an instance with values accumulated in this Builder.

@NonNull LayoutElementBuilders.Text.Builder

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

@NonNull LayoutElementBuilders.Text.Builder

Sets the explicit height between lines of text.

@NonNull LayoutElementBuilders.Text.Builder

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

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

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

@NonNull LayoutElementBuilders.Text.Builder

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

@NonNull LayoutElementBuilders.Text.Builder

Sets alignment of the text within its bounds.

@NonNull LayoutElementBuilders.Text.Builder

Sets alignment of the text within its bounds.

@NonNull LayoutElementBuilders.Text.Builder

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

@NonNull LayoutElementBuilders.Text.Builder

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

@NonNull LayoutElementBuilders.Text.Builder

Sets the text to render.

@NonNull LayoutElementBuilders.Text.Builder

Sets the text to render.

Public constructors

Builder

public Builder()

Public methods

build

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

Builds an instance with values accumulated in this Builder.

setFontStyle

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

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

setLineHeight

@NonNull
public LayoutElementBuilders.Text.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.Text.Builder setMaxLines(@NonNull TypeBuilders.Int32Prop maxLines)

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

setMaxLines

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

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

setMultilineAlignment

@NonNull
public LayoutElementBuilders.Text.Builder setMultilineAlignment(
    @NonNull LayoutElementBuilders.TextAlignmentProp multilineAlignment
)

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

setMultilineAlignment

@NonNull
public LayoutElementBuilders.Text.Builder setMultilineAlignment(
    @LayoutElementBuilders.TextAlignment @NonNull int multilineAlignment
)

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

setOverflow

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

Sets how to handle text which overflows the bound of the Text element. A Text element will grow as large as p