Skip to content Skip to sidebar Skip to footer

Can Android Drawables Defined In Xml Contain A Path?

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

Solution 1:

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

Solution 2:

With the release of Android 5.0 Lollipop (API 21) this is now possible using VectorDrawable

<vectorxmlns:android="http://schemas.android.com/apk/res/android"android:height="64dp"android:width="64dp"android:viewportHeight="600"android:viewportWidth="600" ><groupandroid:name="rotationGroup"android:pivotX="300.0"android:pivotY="300.0"android:rotation="45.0" ><pathandroid:name="v"android:fillColor="#000000"android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" /></group></vector>

Solution 3:

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/

Post a Comment for "Can Android Drawables Defined In Xml Contain A Path?"