Skip to content

Preview on Android Studio

Android Studio's Composable Preview feature is an incredibly powerful tool that allows you to develop and preview a specific part of your Composable without the need to build the entire project.

The versatility of Landscapist extends to supporting preview mode for each image library, including Glide, Coil, and Fresco. You can conveniently showcase preview images directly within your editor using the previewPlaceholder parameter, as demonstrated below:

GlideImage(
  previewPlaceholder = painterResource(id = R.drawable.poster),
  ..
)
CoilImage(
  previewPlaceholder = painterResource(id = R.drawable.poster),
  ..
)
FrescoImage(
  previewPlaceholder = painterResource(id = R.drawable.poster),
  ..
)

This feature streamlines your development process, providing a visual representation of the image before building the entire project, saving valuable time and effort.

Now, you can build your preview composable like so:

@Composable
private fun GlideImagePreview() {
    GlideImage(
      previewPlaceholder = painterResource(id = R.drawable.poster),
      ..
    )
}

Once you compile your preview function, you will see the result displayed below in your Android Studio:

Preview Composable