Glide Image
Requests loading an image with a loading placeholder and error image resource (ImageBitmap, ImageVector, Painter).
GlideImage(
imageModel = imageUrl,
requestBuilder = Glide
.with(LocalContext.current)
.asBitmap()
.apply(RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
.thumbnail(0.6f)
.transition(withCrossFade()),
placeHolder = ImageBitmap.imageResource(R.drawable.placeholder),
error = ImageBitmap.imageResource(R.drawable.error)
)
Parameters
The data model to request image. See RequestBuilder.load for types allowed.
Modifier used to adjust the layout or drawing content.
Most options in Glide can be applied directly on the RequestBuilder object returned by Glide.with().
Provides type independent options to customize loads with Glide.
The alignment parameter used to place the loaded ImageBitmap in the image container.
The alpha parameter used to apply for the image when it is rendered onscreen.
The scale parameter used to determine the aspect ratio scaling to be used for the loaded ImageBitmap.
The content description used to provide accessibility to describe the image.
Whether to run a circular reveal animation when images are successfully loaded.
The duration of the circular reveal animation.
The colorFilter parameter used to apply for the image when it is rendered onscreen.
An ImageBitmap, ImageVector, or Painter to be displayed when the request is in progress.
An ImageBitmap, ImageVector, or Painter for showing instead of the target image when images are failed to load.
Requests loading an image with a loading placeholder and error image resource (ImageBitmap, ImageVector, Painter).
GlideImage(
imageModel = imageUrl,
requestBuilder = Glide
.with(LocalContext.current)
.asBitmap()
.apply(RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
.thumbnail(0.6f)
.transition(withCrossFade()),
circularRevealedEnabled = true,
shimmerParams = ShimmerParams (
baseColor = backgroundColor,
highlightColor = highlightColor
),
error = ImageVector.vectorResource(R.drawable.error)
)
Parameters
The data model to request image. See RequestBuilder.load for types allowed.
Modifier used to adjust the layout or drawing content.
Most options in Glide can be applied directly on the RequestBuilder object returned by Glide.with().
Provides type independent options to customize loads with Glide.
The alignment parameter used to place the loaded ImageBitmap in the image container.
The alpha parameter used to apply for the image when it is rendered onscreen.
The scale parameter used to determine the aspect ratio scaling to be used for the loaded ImageBitmap.
The content description used to provide accessibility to describe the image.
Whether to run a circular reveal animation when images are successfully loaded.
The duration of the circular reveal animation.
The colorFilter parameter used to apply for the image when it is rendered onscreen.
The shimmer related parameter used to determine constructions of the Shimmer.
An ImageBitmap, ImageVector, or Painter for showing instead of the target image when images are failed to load.
Requests loading an image and create some composables based on GlideImageState.
GlideImage(
imageModel = imageUrl,
requestBuilder = Glide
.with(LocalContext.current)
.asBitmap()
.apply(RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
.thumbnail(0.6f)
.transition(withCrossFade()),
modifier = modifier,
shimmerParams = ShimmerParams (
baseColor = backgroundColor,
highlightColor = highlightColor
),
failure = {
Text(text = "image request failed.")
})
Parameters
The data model to request image. See RequestBuilder.load for types allowed.
Modifier used to adjust the layout or drawing content.
Most options in Glide can be applied directly on the RequestBuilder object returned by Glide.with().
Provides type independent options to customize loads with Glide.
The alignment parameter used to place the loaded ImageBitmap in the image container.
The alpha parameter used to apply for the image when it is rendered onscreen.
The scale parameter used to determine the aspect ratio scaling to be used for the loaded ImageBitmap.
The content description used to provide accessibility to describe the image.
Whether to run a circular reveal animation when images are successfully loaded.
The duration of the circular reveal animation.
The colorFilter parameter used to apply for the image when it is rendered onscreen.
The shimmer related parameter used to determine constructions of the Shimmer.
Content to be displayed when the request is succeeded.
Content to be displayed when the request is failed.
Requests loading an image and create some composables based on GlideImageState.
GlideImage(
imageModel = imageUrl,
requestBuilder = Glide
.with(LocalContext.current)
.asBitmap()
.apply(RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
.thumbnail(0.6f)
.transition(withCrossFade()),
modifier = modifier,
loading = {
ConstraintLayout(
modifier = Modifier.fillMaxSize()
) {
val indicator = createRef()
CircularProgressIndicator(
modifier = Modifier.constrainAs(indicator) {
top.linkTo(parent.top)
bottom.linkTo(parent.bottom)
start.linkTo(parent.start)
end.linkTo(parent.end)
}
)
}
},
failure = {
Text(text = "image request failed.")
})
Parameters
The data model to request image. See RequestBuilder.load for types allowed.
Modifier used to adjust the layout or drawing content.
Most options in Glide can be applied directly on the RequestBuilder object returned by Glide.with().
Provides type independent options to customize loads with Glide.
The alignment parameter used to place the loaded ImageBitmap in the image container.
The alpha parameter used to apply for the image when it is rendered onscreen.
The scale parameter used to determine the aspect ratio scaling to be used for the loaded ImageBitmap.
The content description used to provide accessibility to describe the image.
Whether to run a circular reveal animation when images are successfully loaded.
The duration of the circular reveal animation.
The colorFilter parameter used to apply for the image when it is rendered onscreen.
Content to be displayed when the request is in progress.
Content to be displayed when the request is succeeded.
Content to be displayed when the request is failed.