Stylianos Gakis
08/15/2022, 3:21 PMDrawable
, but I can’t figure out a way to get a hold of a Drawable
in a simple way in Compose without going for xml drawables or something like that. Is there some API I’m missing?Chrimaeon
08/15/2022, 3:25 PMColorDrawable
Stylianos Gakis
08/15/2022, 3:27 PMChrimaeon
08/15/2022, 3:29 PMColor
has a toARGB
function that you can pass to the constructor of the ColorDrawable
Stylianos Gakis
08/15/2022, 3:32 PMint
parameter which is annotated with @ColorInt
means this ColorInt. Which reads Denotes that the annotated element represents a packed color int, AARRGGBB. If applied to an int array, every element in the array represents a color integer.
I thought it was referring to an xml source! Thanks a lot! This seems to be exactly what I was looking for.Chrimaeon
08/15/2022, 3:33 PMAlbert Chang
08/15/2022, 3:58 PMplaceholder
parameter and you can use a ColorPainter
.Stylianos Gakis
08/15/2022, 4:12 PMrememberAsyncImagePainter
as I was migrating from 1.x but you’re right I now tried this with the AsyncImage
API which does take a Painter
and that is super straightforward to use. I can just do ColorPainter(hedvigBlack)
. And I had a BitmapDrawable
I was drawing before, but now I can just do BitmapPainter(myBitmapDrawable.bitmap.asImageBitmap())
and that works just fine too, thanks a lot!