LayoutElementBuilders.Text.Builder
public final class LayoutElementBuilders.Text.Builder implements LayoutElementBuilders.LayoutElement.Builder
Builder for Text.
Summary
Public constructors |
|---|
|
Public methods
build
public @NonNull LayoutElementBuilders.Textbuild()
Builds an instance with values accumulated in this Builder.
public @NonNull LayoutElementBuilders.Text.BuildersetFontStyle(@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.
public @NonNull LayoutElementBuilders.Text.BuildersetLineHeight(@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.
public @NonNull LayoutElementBuilders.Text.BuildersetMaxLines(@IntRange(from = 1) 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.
public @NonNull LayoutElementBuilders.Text.BuildersetMaxLines(@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.
public @NonNull LayoutElementBuilders.Text.BuildersetModifiers(@NonNull ModifiersBuilders.Modifiers modifiers)
Sets androidx.wear.tiles.ModifiersBuilders.Modifiers for this element.
public @NonNull LayoutElementBuilders.Text.BuildersetMultilineAlignment(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.
public @NonNull LayoutElementBuilders.Text.BuildersetMultilineAlignment(
@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.
public @NonNull LayoutElementBuilders.Text.BuildersetOverflow(int overflow)
Sets how to handle text which overflows the bound of the Text element. A 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.
public @NonNull LayoutElementBuilders.Text.BuildersetOverflow(@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 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.
public @NonNull LayoutElementBuilders.Text.BuildersetText(@NonNull String text)
Sets the text to render.
public @NonNull LayoutElementBuilders.Text.BuildersetText(@NonNull TypeBuilders.StringProp text)
Sets the text to render.