Create an AppBarIcon Image

K-2SO :

I am using Dev05(which just released).

In the documentation the icon looks like this icon: Image, but in Android Studio the icon is of type Painter(which was added in Dev05) icon: Painter,.

How would I convert an image to this new Painter type? Or am I missing something completely?

Ro4ch :

Use ImagePainter() and pass in the image.

something like this,

val image = ImagePainter(imageResource(R.drawable.YOUR-IMAGE))

 AppBarIcon(image, onClick = {
       //Do something
})

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=7274&siteId=1