I use Inkscape to create the art assets in my app.
At the moment I have to create bitmaps from my (simple) Inkscape vector art before I can use the images in my app.
I would prefer to be able to create an XML Drawable that contains the paths from my art. Can this be done?
Not directly, but there are some third-party workarounds. Have a look at this guide, for example.
With the release of Android 5.0 Lollipop (API 21) this is now possible using VectorDrawable
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="64dp"
android:width="64dp"
android:viewportHeight="600"
android:viewportWidth="600" >
<group
android:name="rotationGroup"
android:pivotX="300.0"
android:pivotY="300.0"
android:rotation="45.0" >
<path
android:name="v"
android:fillColor="#000000"
android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" />
</group>
</vector>
I'm trying the same thing. This project has a pure Java impl. It works OK for simple objects, but failed on some complicated objects. It does have a method to convert SVG path Strings to Path objects...
https://code.google.com/p/svg-android/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With