K-2SO
K-2SO

Reputation: 253

Create an AppBarIcon Image

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?

Upvotes: 2

Views: 407

Answers (2)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363439

With 1.0.0-beta02 you can use:

val image = Image(painterResource(id = R.drawable.xxx),"contentDescription")

Upvotes: 0

Ro4ch
Ro4ch

Reputation: 850

Use ImagePainter() and pass in the image.

something like this,

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

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

Upvotes: 2

Related Questions