5

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
CNorris
  • 308
  • 4
  • 13

3 Answers3

3

Not directly, but there are some third-party workarounds. Have a look at this guide, for example.

Graham Borland
  • 60,055
  • 21
  • 138
  • 179
3

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>
cyon
  • 9,340
  • 4
  • 22
  • 26
2

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/

Dustin
  • 2,064
  • 1
  • 16
  • 12