LayoutElementBuilders.Image.Builder
public final class LayoutElementBuilders.Image.Builder
Builder for Image
.
Summary
Public methods
build
public @NonNull LayoutElementBuilders.Image build()
Builds an instance with values accumulated in this Builder.
setColorFilter
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Image.Builder setColorFilter(@NonNull LayoutElementBuilders.ColorFilter colorFilter)
Sets filtering parameters for this image. If not specified, defaults to no filtering.
setContentScaleMode
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Image.Builder setContentScaleMode(int contentScaleMode)
Sets 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.
setContentScaleMode
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Image.Builder setContentScaleMode(
@NonNull LayoutElementBuilders.ContentScaleModeProp contentScaleMode
)
Sets 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.
setHeight
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Image.Builder setHeight(@NonNull DimensionBuilders.ImageDimension height)
Sets the height of this image. If not defined, the image will not be rendered.
setModifiers
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Image.Builder setModifiers(@NonNull ModifiersBuilders.Modifiers modifiers)
Sets androidx.wear.protolayout.ModifiersBuilders.Modifiers
for this element.
setResourceId
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Image.Builder setResourceId(@NonNull String resourceId)
Sets the resource_id of the image to render. This must exist in the supplied resource bundle.
setResourceId
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Image.Builder setResourceId(@NonNull TypeBuilders.StringProp resourceId)
Sets the resource_id of the image to render. This must exist in the supplied resource bundle.
Note that this field only supports static values.
setWidth
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull LayoutElementBuilders.Image.Builder setWidth(@NonNull DimensionBuilders.ImageDimension width)
Sets the width of this image. If not defined, the image will not be rendered.