https://kotlinlang.org logo
#compose
Title
# compose
m

mattinger

08/28/2020, 5:46 PM
Also struggling to figure out how to load an xml drawable. Apparantly the imageResource function isn’t appropriate for that.
r

Ricardo C.

08/28/2020, 5:52 PM
Try vectorResource
a

Adam Powell

08/28/2020, 5:52 PM
vectorResource doesn't apply to things like layer list/shape drawables. Those aren't supported today.
r

Ricardo C.

08/28/2020, 5:53 PM
Ah I thought he meant a vector 😅
m

mattinger

08/28/2020, 5:55 PM
Yeah, i have a shape file just as a POC for now to house the header image. I tried imageResource and imageFromResource and neither works.
I can always load it as a Drawable and convert to bitmap. ImageAsset has an extension from to convert from Bitmap to ImageAsset.
a

Adam Powell

08/28/2020, 5:59 PM
might be easier to write it as a vector drawable and use the above
n

Nader Jawad

08/28/2020, 6:31 PM
I'm curious what Drawables you are interested in using. @mattinger
The other alternative is to use Modifier.drawBehind and use the corresponding draw calls directly on DrawScope which for a simple shape is a one liner
m

mattinger

08/31/2020, 1:02 PM
Yeah, this won’t be a simple shape unfortunately. It would be something from an xml file for right now. Eventually it would be a png, but as i’m developing, it would be an xml based drawable, so i wanted to figure out how to make it work.