public final class

LayoutElementBuilders.Text

extends java.lang.Object

implements LayoutElementBuilders.LayoutElement

 java.lang.Object

↳androidx.wear.protolayout.LayoutElementBuilders.Text

Overview

A text string.

Summary

Methods
public static LayoutElementBuilders.TextfromProto(LayoutElementProto.Text proto, Fingerprint fingerprint)

Creates a new wrapper instance from the proto.

public FingerprintgetFingerprint()

public LayoutElementBuilders.FontStylegetFontStyle()

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

public TypeBuilders.StringLayoutConstraintgetLayoutConstraintsForDynamicText()

Gets the bounding constraints for the layout affected by the dynamic value from LayoutElementBuilders.Text.getText().

public DimensionBuilders.SpPropgetLineHeight()

Gets the explicit height between lines of text.

public intgetMarqueeIterations()

Gets the number of times to repeat the Marquee animation.

public TypeBuilders.Int32PropgetMaxLines()

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

public ModifiersBuilders.ModifiersgetModifiers()

Gets ModifiersBuilders.Modifiers for this element.

public LayoutElementBuilders.TextAlignmentPropgetMultilineAlignment()

Gets alignment of the text within its bounds.

public LayoutElementBuilders.TextOverflowPropgetOverflow()

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

public TypeBuilders.StringPropgetText()

Gets the text to render.

public LayoutElementProto.LayoutElementtoLayoutElementProto()

public java.lang.StringtoString()

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

Methods

public TypeBuilders.StringProp getText()

Gets 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.

public LayoutElementBuilders.FontStyle getFontStyle()

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

public ModifiersBuilders.Modifiers getModifiers()

Gets ModifiersBuilders.Modifiers for this element.

public TypeBuilders.Int32Prop getMaxLines()

Gets 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.TextAlignmentProp getMultilineAlignment()

Gets 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.

Gets 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 DimensionBuilders.SpProp getLineHeight()

Gets 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 int getMarqueeIterations()

Gets 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 TypeBuilders.StringLayoutConstraint getLayoutConstraintsForDynamicText()

Gets the bounding constraints for the layout affected by the dynamic value from LayoutElementBuilders.Text.getText().

public Fingerprint getFingerprint()

public static LayoutElementBuilders.Text fromProto(LayoutElementProto.Text proto, Fingerprint fingerprint)

Creates a new wrapper instance from the proto.

public LayoutElementProto.LayoutElement toLayoutElementProto()

public java.lang.String toString()