Skip to content
🤔 Documentation issue? Report or edit

How to load an image

Load Image

You can use painterResource to load an image from the resources

fun ImageResourceDemo() {
    val image: Painter = painterResource(id = R.drawable.composelogo)
    Image(painter = image,contentDescription = "")
Or load an Icon from Material Icons

fun ImageResourceDemo() {
    Icon(Icons.Rounded.Home,contentDescription = "")

Remember to add dependencies to build.gradle

    implementation "androidx.compose.material:material-icons-extended:$compose_version"

See also:

Last update: November 16, 2021
Back to top