public final class

LayoutElementBuilders.Text.Builder

extends java.lang.Object

implements LayoutElementBuilders.LayoutElement.Builder

 java.lang.Object

↳androidx.wear.protolayout.LayoutElementBuilders.Text.Builder

Overview

Builder for LayoutElementBuilders.Text.

Summary

Constructors
publicBuilder()

Creates an instance of LayoutElementBuilders.FontWeightProp.Builder.

Methods
public LayoutElementBuilders.Textbuild()

public LayoutElementBuilders.Text.BuildersetFontStyle(LayoutElementBuilders.FontStyle fontStyle)

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

public LayoutElementBuilders.Text.BuildersetLayoutConstraintsForDynamicText(TypeBuilders.StringLayoutConstraint stringLayoutConstraint)

Sets the bounding constraints for the layout affected by the dynamic value from LayoutElementBuilders.Text.Builder}.

public LayoutElementBuilders.Text.BuildersetLineHeight(DimensionBuilders.SpProp lineHeight)

Sets the explicit height between lines of text.

public LayoutElementBuilders.Text.BuildersetMarqueeIterations(int marqueeIterations)

Sets the number of times to repeat the Marquee animation.

public LayoutElementBuilders.Text.BuildersetMaxLines(int maxLines)

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

public LayoutElementBuilders.Text.BuildersetMaxLines(TypeBuilders.Int32Prop maxLines)

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

public LayoutElementBuilders.Text.BuildersetModifiers(ModifiersBuilders.Modifiers modifiers)

Sets ModifiersBuilders.Modifiers for this element.

public LayoutElementBuilders.Text.BuildersetMultilineAlignment(int multilineAlignment)

Sets alignment of the text within its bounds.

public LayoutElementBuilders.Text.BuildersetMultilineAlignment(LayoutElementBuilders.TextAlignmentProp multilineAlignment)

Sets alignment of the text within its bounds.

public LayoutElementBuilders.Text.BuildersetOverflow(int overflow)

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

public LayoutElementBuilders.Text.BuildersetOverflow(LayoutElementBuilders.TextOverflowProp overflow)

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

public LayoutElementBuilders.Text.BuildersetText(java.lang.String text)

Sets the static text to render.

public LayoutElementBuilders.Text.BuildersetText(TypeBuilders.StringProp text)

Sets the text to render.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

Creates an instance of LayoutElementBuilders.FontWeightProp.Builder.

Methods

Sets the text to render.

While this field is statically accessible from 1.0, it's only bindable since version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).

When using a dynamic value, make sure to specify the bounding constraints for the affected layout element through setLayoutConstraintsForDynamicText(StringLayoutConstraint) otherwise build() fails.

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

Sets ModifiersBuilders.Modifiers for this element.

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.

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.

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

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.

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.

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.

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 LayoutElementBuilders.Text.Builder setMarqueeIterations(int marqueeIterations)

Sets the number of times to repeat the Marquee animation. Only applies when overflow is TEXT_OVERFLOW_MARQUEE. Set to -1 to repeat indefinitely. Defaults to repeat indefinitely.

public LayoutElementBuilders.Text.Builder setLayoutConstraintsForDynamicText(TypeBuilders.StringLayoutConstraint stringLayoutConstraint)

Sets the bounding constraints for the layout affected by the dynamic value from LayoutElementBuilders.Text.Builder}.

public LayoutElementBuilders.Text.Builder setText(java.lang.String text)

Sets the static text to render.