Im attempting to replace all my Android
drawable png assets with VectorDrawables.
Where I use the Android Studio
standard assets obviously everything is fine.
Some externally imported SVG assets fail as Android does not support the industry-standard SVG specification.
Does an Android vector drawable specification exist? which lists all acceptable SVG commands that Android (Android Studio) will accept?
As far as I am aware, there is no formal written specification for the VectorDrawable format other than the VectorDrawable
class definition in the documentation.
https://developer.android.com/reference/android/graphics/drawable/VectorDrawable
There is also quite a lot of extra information on this page:
https://developer.android.com/studio/write/vector-asset-studio
Neither of these have a list of SVG elements that are supported by the importer. However you can look at the code for the importer in the Android source code for the definitive answer as to what is supported. The source code is here: SVG2Vector.java
From the code, you can see that the supported SVG elements are limited to:
<polygon>
, <rect>
, <circle>
, <line>
, <path>
, <g>
Note that these are only partially supported, as only a limited set of their attributes are handled. Basically just the stroke
and fill
related ones, plus transform
and display:none
.
There are, however, other third-party converters available that claim to do a better job. Although what they can possibly support is limited by what VectorDrawable itself supports.