# TitleChip

Artifact: [androidx.wear.tiles:tiles-material](https://developer.android.com/jetpack/androidx/releases/wear-tiles) [View Source](https://cs.android.com/search?q=file:androidx/wear/tiles/material/TitleChip.java+class:androidx.wear.tiles.material.TitleChip) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

*** ** * ** ***


```
public class TitleChip implements LayoutElementBuilders.LayoutElement
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> Use the new class `https://developer.android.com/reference/androidx/wear/protolayout/material/TitleChip` which provides the same API and functionality.

Tiles component `https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip` that represents clickable object with the text.

The Title Chip is Stadium shaped object with a larger height then standard Chip and it will take one line of text of `https://developer.android.com/reference/androidx/wear/tiles/material/Typography#TYPOGRAPHY_TITLE2()` style.

The recommended set of `https://developer.android.com/reference/androidx/wear/tiles/material/ChipColors` styles can be obtained from `https://developer.android.com/reference/androidx/wear/tiles/material/ChipDefaults`, e.g. `https://developer.android.com/reference/androidx/wear/tiles/material/ChipDefaults#TITLE_PRIMARY_COLORS()` to get a color scheme for a primary `https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip`.

When accessing the contents of a container for testing, note that this element can't be simply casted back to the original type, i.e.:

```
TitleChip chip = new TitleChip...
Box box = new Box.Builder().addContent(chip).build();

TitleChip myChip = (TitleChip) box.getContents().get(0);
```
will fail.

To be able to get `https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip` object from any layout element, `https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#fromLayoutElement(androidx.wear.tiles.LayoutElementBuilders.LayoutElement)` method should be used, i.e.:

```
TitleChip myChip = TitleChip.fromLayoutElement(box.getContents().get(0));
```

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout.Builder#setContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement)` | if this TitleChip is used inside of `https://developer.android.com/reference/androidx/wear/tiles/material/layouts/PrimaryLayout`. |

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip.Builder implements https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders.LayoutElement.Builder` **This class is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip` | `[fromLayoutElement](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#fromLayoutElement(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders.LayoutElement element)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/ChipColors` | `[getChipColors](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getChipColors())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/ModifiersBuilders.Clickable` | `[getClickable](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getClickable())()` **This method is deprecated.** Deprecated in Java |
| `int` | `[getHorizontalAlignment](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getHorizontalAlignment())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `[getText](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getText())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/DimensionBuilders.ContainerDimension` | `[getWidth](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getWidth())()` **This method is deprecated.** Deprecated in Java |

## Public methods

### fromLayoutElement

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public static @Nullable TitleChip [fromLayoutElement](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#fromLayoutElement(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(@NonNull LayoutElementBuilders.LayoutElement element)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns TitleChip object from the given androidx.wear.tiles.LayoutElementBuilders.LayoutElement (e.g. one retrieved from a container's content with `container.getContents().get(index)`) if that element can be converted to TitleChip. Otherwise, it will return null.

### getChipColors

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull ChipColors [getChipColors](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getChipColors())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns chip color of this Chip.

### getClickable

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull ModifiersBuilders.Clickable [getClickable](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getClickable())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns click event action associated with this Chip.

### getHorizontalAlignment

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public int [getHorizontalAlignment](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getHorizontalAlignment())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns the horizontal alignment of the content in this Chip.

### getText

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull String [getText](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getText())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns text content of this Chip.

### getWidth

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull DimensionBuilders.ContainerDimension [getWidth](https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip#getWidth())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Returns width of this Chip.