Image

Composable Function

Android
@Composable
fun Image(
    provider: ImageProvider,
    contentDescription: String?,
    modifier: GlanceModifier = GlanceModifier,
    contentScale: ContentScale = ContentScale.Fit,
    colorFilter: ColorFilter? = null,
) = ImageElement(provider, contentDescription, modifier, contentScale, colorFilter, alpha = null)

A composable which lays out and draws the image specified in provider. This will attempt to lay out the image using the intrinsic width and height of the provided image, but this can be overridden by using a modifier to set the width or height of this element.

Parameters

providerThe image provider to use to draw the image
contentDescriptiontext used by accessibility services to describe what this image represents. This should always be provided unless this image is used for decorative purposes, and does not represent a meaningful action that a user can take. This text should be localized.
modifierModifier used to adjust the layout algorithm or draw decoration content.
contentScaleHow to lay the image out with respect to its bounds, if the bounds are smaller than the image.
colorFilterThe effects to use to modify the color of an image.
Android
@Composable
fun Image(
    provider: ImageProvider,
    contentDescription: String?,
    @FloatRange(from = 0.0, to = 1.0) alpha: Float,
    modifier: GlanceModifier = GlanceModifier,
    contentScale: ContentScale = ContentScale.Fit,
    colorFilter: ColorFilter? = null,
) = ImageElement(provider, contentDescription, modifier, contentScale, colorFilter, alpha)

A composable which lays out and draws the image specified in provider. This will attempt to lay out the image using the intrinsic width and height of the provided image, but this can be overridden by using a modifier to set the width or height of this element.

Parameters

providerThe image provider to use to draw the image
contentDescriptiontext used by accessibility services to describe what this image represents. This should always be provided unless this image is used for decorative purposes, and does not represent a meaningful action that a user can take. This text should be localized.
alphaOpacity (0f to 1f) to apply to the image.
modifierModifier used to adjust the layout algorithm or draw decoration content.
contentScaleHow to lay the image out with respect to its bounds, if the bounds are smaller than the image.
colorFilterThe effects to use to modify the color of an image.