{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ImageVector.Companion


Provide an empty companion object to hang platform-specific companion extensions onto.

Summary

Extension functions

ImageVector

Load an ImageVector from a vector resource.

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

Extension functions

vectorResource

@Composable
fun ImageVector.Companion.vectorResource(id: @DrawableRes Int): ImageVector

Load an ImageVector from a vector resource.

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

Parameters
id: @DrawableRes Int

the resource identifier

Returns
ImageVector

the vector data associated with the resource

vectorResource

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