Also struggling to figure out how to load an xml d...
# compose
m
Also struggling to figure out how to load an xml drawable. Apparantly the imageResource function isn’t appropriate for that.
r
Try vectorResource
a
vectorResource doesn't apply to things like layer list/shape drawables. Those aren't supported today.
r
Ah I thought he meant a vector 😅
m
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
might be easier to write it as a vector drawable and use the above
n
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
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.