# LayoutElementBuilders.Image

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.Image) 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.Image implements LayoutElementBuilders.LayoutElement
```

<br />

*** ** * ** ***

An image.

Images used in this element must exist in the resource bundle that corresponds to this layout. Images must have their dimension specified, and will be rendered at this width and height, regardless of their native dimension.

## Summary

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

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.ColorFilter` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Image#getColorFilter()()` Gets filtering parameters for this image. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.ContentScaleModeProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Image#getContentScaleMode()()` Gets how to scale the image resource inside the bounds specified by width/height if its size does not match those bounds. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.ImageDimension` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Image#getHeight()()` Gets the height of this image. |
| `@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.Image#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/TypeBuilders.StringProp` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Image#getResourceId()()` Gets the resource_id of the image to render. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/wear/protolayout/DimensionBuilders.ImageDimension` | `https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.Image#getWidth()()` Gets the width of this image. |
| `@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.Image#toString()()` |

## Public methods

### getColorFilter

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

```
public @Nullable LayoutElementBuilders.ColorFilter getColorFilter()
```

Gets filtering parameters for this image. If not specified, defaults to no filtering.

### getContentScaleMode

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

```
public @Nullable LayoutElementBuilders.ContentScaleModeProp getContentScaleMode()
```

Gets how to scale the image resource inside the bounds specified by width/height if its size does not match those bounds. Defaults to CONTENT_SCALE_MODE_FIT.

### getHeight

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

```
public @Nullable DimensionBuilders.ImageDimension getHeight()
```

Gets the height of this image. If not defined, the image will not be rendered.

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

### getResourceId

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

```
public @Nullable TypeBuilders.StringProp getResourceId()
```

Gets the resource_id of the image to render. This must exist in the supplied resource bundle.

### getWidth

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

```
public @Nullable DimensionBuilders.ImageDimension getWidth()
```

Gets the width of this image. If not defined, the image will not be rendered.

### toString

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