painterResource
Android
@Composable
fun painterResource(@DrawableRes id: Int): Painter
Create a Painter from an Android resource id. This can load either an instance of BitmapPainter or VectorPainter for ImageBitmap based assets or vector based assets respectively. The resources with the given id must point to either fully rasterized images (ex. PNG or JPG files) or VectorDrawable xml assets. API based xml Drawables are not supported here.
Alternative Drawable implementations can be used with compose by calling drawIntoCanvas and drawing with the Android framework canvas provided through nativeCanvas
Parameters
| id | Resources object to query the image file from |
Returns
Painter used for drawing the loaded resource |