imageiconsandroid-jetpack-composeandroid-iconsgoogle-material-icons

How can I access all material icons in Android Studio through Icon in Jetpack Compose


Jetpack Compose has an Icon composable where I can access an imageVector. See example below.

Icon(
     imageVector = Icons.Rounded.Email,
     contentDescription = "Email Icon",
)

Why can I not access all icons listed in this Material Icons library through this imageVector. For example, "wifi_off" can't be accessed. There is a very limited library accessible via imageVector

https://fonts.google.com/icons?selected=Material+Icons&icon.style=Rounded&icon.platform=android


Solution

  • Just add the dependency

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

    and use:

    Icon(
        imageVector = Icons.Rounded.WifiOff,
        contentDescription = "Email Icon",
    )
    

    enter image description here

    As described in the doc:

    androidx.compose.material.icons is the entry point for using Material Icons in Compose, designed to provide icons that match those described at fonts.google.com/icons.
    The most commonly used set of Material icons are provided by androidx.compose.material:material-icons-core.
    A separate library, androidx.compose.material:material-icons-extended, contains the full set of Material icons.