Support for vector drawings and animated vector drawings Vector drawables allow you to replace multiple png objects with one vector graphic defined in XML. While previously limited to Lollipop and higher devices, VectorDrawable and AnimatedVectorDrawable now available through two new supported support libraries: vector and animated-vector, respectively.
Android Studio 1.4 introduced limited support for vector drawables by creating pngs at build time. To disable this functionality (and get the true edge and space savings of this support library), you need to add vectorDrawables.useSupportLibrary = true to your build.gradle file:
// Gradle Plugin 2.0+ android { defaultConfig { vectorDrawables.useSupportLibrary = true } }
You will note that this new attribute only exists in version 2.0 of the Gradle plugin. If you use Gradle 1.5, you use instead
// Gradle Plugin 1.5 android { defaultConfig { generatedDensities = [] } // This is handled for you by the 2.0+ Gradle Plugin aaptOptions { additionalParameters "--no-version-vectors" } }
And your xml layout will add this app:srcCompat="@drawable/ic_add" code app:srcCompat="@drawable/ic_add" . Like this code:
<android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" app:srcCompat="@drawable/ic_add_24dp" />
Useful link Support for vector drawings and animated vector drawings
source share