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

Travis Griggs

02/24/2023, 12:12 AM
IIUC, Compose doesn't really bring anything new to the "I have SVG icons how do I use them in my app" story. It's still hope you can get them converted to Drawable resources and then use the drawables. As Image composables, I believe? (as opposed to Icon)
e

enighma

02/24/2023, 2:15 AM
You can always convert SVGs to an Android Vector Drawable using Android Studio: https://developer.android.com/studio/write/vector-asset-studio That being said. SVG is a huge format, and AVD does not support all the tags. You can see AVDs as a lightweight version of SVG that Android can render efficiently 🙂 Hope this helps a little!
l

Landry Norris

02/24/2023, 4:11 PM
You can also use the svg2compose IJ plugin to convert your svg to compose icons. These are cross-platform.
e

enighma

02/24/2023, 7:30 PM
TIL. That sounds like another good alternative. Does it crate something to Icons.Filled.<X> ?
t

Travis Griggs

02/24/2023, 10:27 PM
I'll have to look at that plugin. I've converted our SVG icons for a long time into "older android" implemenations of this app, and it's a pain. Saying it is a "subset" doesn't do the truth justice. I've frequently had to go redraw icons or simplify them, to get the import/convert thing to work correctly. For iOS... I just run:
Copy code
/usr/local/bin/inkscape --export-background-opacity=0 --export-filename=${Target}/${name}.pdf ${PWD}/${name}.svg
to create a PDF that drops right into Assets directory and has worked every single time.
10 Views