# EdgeContentLayout

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

*** ** * ** ***


```
public class EdgeContentLayout implements LayoutElementBuilders.LayoutElement
```

<br />

*** ** * ** ***

ProtoLayout layout that represents the suggested layout style for Material ProtoLayout, which has content around the edge of the screen (e.g. a ProgressIndicator) and the given content inside of it with the recommended margin and padding applied. Optional primary or secondary label can be added above and below the additional content, respectively. Visuals and design samples can be found [here](https://developer.android.com/design/ui/wear/guides/surfaces/tiles-layouts#layout-templates).

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

```
EdgeContentLayout ecl = new EdgeContentLayout...
Box box = new Box.Builder().addContent(ecl).build();

EdgeContentLayout myEcl = (EdgeContentLayout) box.getContents().get(0);
```
will fail.

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

```
EdgeContentLayout myEcl =
  EdgeContentLayout.fromLayoutElement(box.getContents().get(0));
```

## Summary

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

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout#fromLayoutElement(androidx.wear.protolayout.LayoutElementBuilders.LayoutElement)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement element)` Returns EdgeContentLayout object from the given LayoutElement (e.g. one retrieved from a container's content with `container.getContents().get(index)`) if that element can be converted to EdgeContentLayout. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout#getContent()()` Returns the inner content from this layout. |
| `@https://developer.android.com/reference/androidx/annotation/Dimension(unit = https://developer.android.com/reference/androidx/annotation/Dimension.DP) float` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout#getContentAndSecondaryLabelSpacing()()` Get the size of spacing between content and secondary from this layout. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout#getEdgeContent()()` Returns the edge content from this layout. |
| `float` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout#getEdgeContentThickness()()` Returns the total size of the edge content including margins. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout#getPrimaryLabelTextContent()()` Get the primary label content from this layout. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout#getSecondaryLabelTextContent()()` Get the secondary label content from this layout. |
| `boolean` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout#isEdgeContentBehindAllOtherContent()()` Returns if the edge content has been placed behind the other contents. |
| `boolean` | `https://developer.android.com/reference/androidx/wear/protolayout/material/layouts/EdgeContentLayout#isResponsiveContentInsetEnabled()()` Returns whether the contents from this layout are using responsive inset. |

## Public methods

### fromLayoutElement

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

```
public static @Nullable EdgeContentLayout fromLayoutElement(@NonNull LayoutElementBuilders.LayoutElement element)
```

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

### getContent

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

```
public @Nullable LayoutElementBuilders.LayoutElement getContent()
```

Returns the inner content from this layout.

### getContentAndSecondaryLabelSpacing

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

```
public @Dimension(unit = Dimension.DP) float getContentAndSecondaryLabelSpacing()
```

Get the size of spacing between content and secondary from this layout.

### getEdgeContent

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

```
public @Nullable LayoutElementBuilders.LayoutElement getEdgeContent()
```

Returns the edge content from this layout.

### getEdgeContentThickness

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

```
public float getEdgeContentThickness()
```

Returns the total size of the edge content including margins.

### getPrimaryLabelTextContent

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

```
public @Nullable LayoutElementBuilders.LayoutElement getPrimaryLabelTextContent()
```

Get the primary label content from this layout.

### getSecondaryLabelTextContent

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

```
public @Nullable LayoutElementBuilders.LayoutElement getSecondaryLabelTextContent()
```

Get the secondary label content from this layout.

### isEdgeContentBehindAllOtherContent

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

```
public boolean isEdgeContentBehindAllOtherContent()
```

Returns if the edge content has been placed behind the other contents.

### isResponsiveContentInsetEnabled

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

```
public boolean isResponsiveContentInsetEnabled()
```

Returns whether the contents from this layout are using responsive inset.