I've noticed that Android now supports some kind of vector drawing, via a class called "VectorDrawable" (and also AnimatedVectorDrawable, BTW). I've found about it by looking at what's new on Android-Studio.
I wonder if this would be the end of having to put multiple files into multiple folders (mdpi
, hdpi
, xhdpi
, etc). That would be great and might minimize apps sizes on some cases.
I'd like to ask a few questions regarding this new class:
Is it possible to use it in older Android versions, maybe via a library of even the support library of Google?
I'm not familiar with how it works, but can Lollipop handle SVG files? Can it do anything that is achievable on SVG files?
Is there any sample/tutorial/video of using it, other than the documentation I've found?
By Android Support Library 23.2.1 update, Support Vector Drawables and Animated Vector Drawables. (you can also use latestone for the same)
Please update version of a library in gradle file.
compile 'com.android.support:recyclerview-v7:23.2.1'
Vector drawables allow you to replace multiple png assets with a single vector graphic, defined in XML. While previously limited to Lollipop and higher devices, both VectorDrawable
and AnimatedVectorDrawable
are now available through two new Support Libraries support-vector-drawable and animated-vector-drawable. new app:srcCompat
attribute to reference vector drawables .
Check source on github with some sample examples.
Changes for v7 appcompat library:
Reverted dependency on vector assets so that developers using the appcompat library are not forced to use VectorDrawable
and its associated build flags.