androidx.compose.ui.res

Exceptions

ResourceResolutionException

Throwable that is thrown in situations where a resource failed to load.

Composables

booleanResource

Load a boolean resource.

colorResource

Load a color resource.

dimensionResource

Load a dimension resource.

fontResource

Synchronously load an font from FontFamily.

imageResource

Load an ImageBitmap from an image resource.

integerArrayResource

Load an array of integer resource.

integerResource

Load an integer resource.

painterResource

Create a Painter from an Android resource id.

pluralStringResource

Load a plurals resource.

stringArrayResource

Load a string resource.

stringResource

Load a string resource.

vectorResource

Load an ImageVector from a vector resource.

Extension functions summary

ImageBitmap

Load an ImageBitmap from an image resource.

ImageVector
ImageVector.Companion.vectorResource(
    theme: Resources.Theme?,
    res: Resources,
    resId: Int
)

Extension functions

ImageBitmap.Companion.imageResource

fun ImageBitmap.Companion.imageResource(res: Resources, id: @DrawableRes 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.

Returns
ImageBitmap

Loaded image file represented as an ImageBitmap

ImageVector.Companion.vectorResource

fun ImageVector.Companion.vectorResource(
    theme: Resources.Theme? = null,
    res: Resources,
    resId: Int
): ImageVector