# LayoutElementBuilders.Spannable

Artifact: [androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/LayoutElementBuilders.java+class:androidx.wear.protolayout.LayoutElementBuilders.Spannable) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


```
@RequiresSchemaVersion(major = 1, minor = 0)
public final class LayoutElementBuilders.Spannable implements LayoutElementBuilders.LayoutElement
```

<br />

*** ** * ** ***

A container of `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Span` elements. Currently, this supports `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.SpanImage` and `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.SpanText` elements, where each individual `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Span` can have different styling applied to it but the resulting text will flow naturally. This allows sections of a paragraph of text to have different styling applied to it, for example, making one or two words bold or italic.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable.Builder` Builder for `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable`. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.SpProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable#getLineHeight()()` Gets the explicit height between lines of text. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = "-1") int` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/ProtoLayoutExperimental https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable#getMarqueeIterations()()` Gets the number of times to repeat the Marquee animation. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/TypeBuilders.Int32Prop` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable#getMaxLines()()` Gets the maximum number of lines that can be represented by the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Modifiers` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable#getModifiers()()` Gets `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Modifiers` for this element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.HorizontalAlignmentProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable#getMultilineAlignment()()` Gets alignment of the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` content within its bounds. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.TextOverflowProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable#getOverflow()()` Gets how to handle content which overflows the bound of the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` element. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Span>` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable#getSpans()()` Gets the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Span` elements that form this `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable#toString()()` |

## Public methods

### getLineHeight

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @Nullable 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.

### getMarqueeIterations

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@ProtoLayoutExperimental
public @IntRange(from = "-1") 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.

### getMaxLines

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @Nullable TypeBuilders.Int32Prop getMaxLines()
```

Gets the maximum number of lines that can be represented by the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` element. If not defined, the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` element will be treated as a single-line element.

### getModifiers

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @Nullable ModifiersBuilders.Modifiers getModifiers()
```

Gets `https://developer.android.com/reference/androidx/wear/protolayout/ModifiersBuilders.Modifiers` for this element.

### getMultilineAlignment

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @Nullable LayoutElementBuilders.HorizontalAlignmentProp getMultilineAlignment()
```

Gets alignment of the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` content within its bounds. Note that a `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` element will size itself to wrap its contents, so this option is meaningless for single-line content (for that, use alignment of the outer container). For multi-line content, however, this will set the alignment of lines relative to the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` element bounds. If not defined, defaults to TEXT_ALIGN_CENTER.

### getOverflow

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @Nullable LayoutElementBuilders.TextOverflowProp getOverflow()
```

Gets how to handle content which overflows the bound of the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` element. A `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable` 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 content, the content which cannot fit inside its container will be truncated. If not defined, defaults to TEXT_OVERFLOW_TRUNCATE.

### getSpans

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @NonNull List<LayoutElementBuilders.Span> getSpans()
```

Gets the `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Span` elements that form this `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Spannable`.

### toString

```
public @NonNull String toString()
```