public final class

Text.Builder

extends java.lang.Object

implements LayoutElementBuilders.LayoutElement.Builder

 java.lang.Object

↳androidx.wear.tiles.material.Text.Builder

Overview

Builder class for Text.

Summary

Constructors
publicBuilder(Context context, java.lang.String text)

Creates a builder for Text.

Methods
public Textbuild()

Constructs and returns Text with the provided content and look.

public Text.BuildersetColor(ColorBuilders.ColorProp color)

Sets the color for the Text.

public Text.BuildersetItalic(boolean italic)

Sets the text to be italic.

public Text.BuildersetMaxLines(int maxLines)

Sets the maximum lines of text.

public Text.BuildersetModifiers(ModifiersBuilders.Modifiers modifiers)

Sets the modifiers of text.

public Text.BuildersetMultilineAlignment(int multilineAlignment)

Sets the multiline alignment for text within bounds of the Text element.

public Text.BuildersetOverflow(int overflow)

Sets the overflow for text.

public Text.BuildersetTypography(int typography)

Sets the typography for the Text.

public Text.BuildersetUnderline(boolean underline)

Sets the text to be underlined.

public Text.BuildersetWeight(int weight)

Sets the weight of the font.

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

Constructors

public Builder(Context context, java.lang.String text)

Creates a builder for Text.

Parameters:

context: The application's context.
text: The text content for this component.

Methods

public Text.Builder setTypography(int typography)

Sets the typography for the Text. If not set, Typography.TYPOGRAPHY_DISPLAY1 will be used.

public Text.Builder setColor(ColorBuilders.ColorProp color)

Sets the color for the Text. If not set, onPrimary color from the Colors.DEFAULT will be used.

public Text.Builder setItalic(boolean italic)

Sets the text to be italic. If not set, false will be used.

public Text.Builder setUnderline(boolean underline)

Sets the text to be underlined. If not set, false will be used.

public Text.Builder setMaxLines(int maxLines)

Sets the maximum lines of text. If not set, 1 will be used.

public Text.Builder setMultilineAlignment(int multilineAlignment)

Sets the multiline alignment for text within bounds of the Text element. Note that this option has no effect for single line of text, and for that, alignment on the outer container should be used. If not set, LayoutElementBuilders.TEXT_ALIGN_CENTER will be used.

public Text.Builder setModifiers(ModifiersBuilders.Modifiers modifiers)

Sets the modifiers of text.

public Text.Builder setOverflow(int overflow)

Sets the overflow for text. If not set, LayoutElementBuilders.TEXT_OVERFLOW_ELLIPSIZE_END will be used.

public Text.Builder setWeight(int weight)

Sets the weight of the font. If not set, default weight for the chosen Typography will be used.

public Text build()

Constructs and returns Text with the provided content and look.