Text


Specifies a plain-text configuration.

Introduced in Wear OS 4.

Syntax

<Text align="START | CENTER | END" ellipsis="boolean"
      maxLines="integer" isAutoSize="boolean">
    <!-- Possible inner elements. The PartText element syntax shows a
         more complete example. -->
    <Font ... />
    <BitmapFont ... />
</Text>

Attributes

The Text element has the following optional attributes:

align

Determines the text's alignment within its parent element:

  • START: left- or top-aligned (right-aligned when the current language uses an RTL text direction)
  • CENTER: center-aligned
  • END: right- or bottom-aligned (left-aligned when the current language uses an RTL text direction)

The default value is CENTER.

ellipsis

A boolean value that indicates whether to show an ellipsis if the text is too long to fit in the parent element. The default is FALSE.

maxLines

A non-zero integer that indicates the maximum number of lines that the parent element can use to display the text. If this value is less than 0, the watch face arranges the text in the optimal number of lines for taking up the parent element's height.

isAutoSize

Downscales the font size to fit the bounds of the containing PartText, with a minimum font size of 12px, or the Font minSize since v5. If used in conjunction with ellipsis, first the text is scaled down, then if the text still exceeds the bounds, the ellipsis is applied.

verticalAlign

How to align the text vertically within the bounding box:

  • TOP: the text top edge is aligned on the top of the bounding box.
  • BOTTOM: the text bottom edge is aligned on the bottom of the bounding box.
  • CENTER: the text center is aligned on the center of the bounding box.
  • CENTER_ON_BASELINE: the text baseline is aligned on the center of the bounding box.
lineSpacing
Adjusts the vertical gap between lines. Negative values are permitted but capped at -5 to avoid rendering glitches and severe overlapping.

Inner elements

The Text element can contain any number of the following inner elements: