Composable Function

imageResource

Load an ImageBitmap from an image resource.

imageResource

Source set: Android
@Composable
public fun ImageBitmap.Companion.imageResource(@DrawableRes id: Int): ImageBitmap

Load an ImageBitmap from an image resource.

This function is intended to be used for when low-level ImageBitmap-specific functionality is required. For simply displaying onscreen, the vector/bitmap-agnostic painterResource is recommended instead.

Parameters

id the resource identifier

Return

the decoded image data associated with the resource

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: