It's great that K Compose for Desktop gives us out-of-the-box SVGrendering support now, and unfortunate that the same direct support doesn't exist for Android 😞 .
Those who are using SVG across multiple platforms including Android, what does your solution look like?
In a recent project, I wrapped the
SVGView
from Caverock's AndroidSVG library. It was last updated in 2019 but works well, wrapped in an `AndroidView`; no complaints! I might do that again, but interested to hear alternatives?
c
Csaba Kozák
11/10/2021, 12:06 PM
You can also use Coil’s SVG support.
👍 2
j
Javier
11/10/2021, 12:10 PM
I just transform the svg to vector drawable and I use it from a common function in desktop and android
A nice fast binary format (read: not XML) for simple vectors that works across platforms would surely be welcome 👍
e
ephemient
11/11/2021, 5:35 AM
IMO, XML isn't the biggest issue; Android XML resources are all compressed at build time into what is effectively a binary stream of parse events, which cuts out a big chunk of the runtime cost on each device
ephemient
11/11/2021, 5:40 AM
but SVG has too many things that require a lot of infrastructure to support (DOM, fonts, filters, etc.) while AVD is simultaneously too limited of a subset as well as being tied to Android (attr references for gradients etc.). having a reasonably sane cross-platform vector format would definitely be great :)
d
darkmoon_uk
11/13/2021, 5:21 AM
@Csaba Kozák Thanks for your earlier suggestion to use Coil for SVG. I used this to create a cross Desktop/Android
svgPainter
function that can display an SVG loaded from MokoResources on either platform - perfect 😄