LayoutElementBuilders.Image

public final class LayoutElementBuilders.Image implements LayoutElementBuilders.LayoutElement


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

LayoutElementBuilders.Image.Builder

Builder for Image.

Public methods

static @NonNull LayoutElementBuilders.Image.Builder

Returns a new Builder.

@Nullable LayoutElementBuilders.ContentScaleModeProp

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

@TilesExperimental @Nullable LayoutElementBuilders.ColorFilter

Gets filtering parameters for this image.

@Nullable DimensionBuilders.ImageDimension

Gets the height of this image.

@Nullable ModifiersBuilders.Modifiers

Gets androidx.wear.tiles.ModifiersBuilders.Modifiers for this element.

@Nullable TypeBuilders.StringProp

Gets the resource_id of the image to render.

@Nullable DimensionBuilders.ImageDimension

Gets the width of this image.

Public methods

builder

@NonNull
public static LayoutElementBuilders.Image.Builder builder()

Returns a new Builder.

getContentScaleMode

@Nullable
@NonNull
public 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. Intended for testing purposes only.

getFilter

@TilesExperimental
@Nullable
@NonNull
public @TilesExperimental LayoutElementBuilders.ColorFilter getFilter()

Gets filtering parameters for this image. If not specified, defaults to no filtering. Intended for testing purposes only.

getHeight

@Nullable
@NonNull
public DimensionBuilders.ImageDimension getHeight()

Gets the height of this image. If not defined, the image will not be rendered. Intended for testing purposes only.

getModifiers

@Nullable
@NonNull
public ModifiersBuilders.Modifiers getModifiers()

Gets androidx.wear.tiles.ModifiersBuilders.Modifiers for this element. Intended for testing purposes only.

getResourceId

@Nullable
@NonNull
public TypeBuilders.StringProp getResourceId()

Gets the resource_id of the image to render. This must exist in the supplied resource bundle. Intended for testing purposes only.

getWidth

@Nullable
@NonNull
public DimensionBuilders.ImageDimension getWidth()

Gets the width of this image. If not defined, the image will not be rendered. Intended for testing purposes only.