Android Vector Drawable Icon
In my application i have to set a large icon for a notification.
Android vector drawable icon. Select a local svg file the one you generated online. Flaticon the largest database of free vector icons. In order to add this functionality in a mobile application android studio includes a tool called the vector asset studio that is used to add some predefined material icons along with your own scalable vector graphic svg and adobe photoshop document psd as vector files in your android application. Vectordrawable defines a static drawable object.
Here is the sample of code. Go to new vector. Free vector icons in svg psd png eps and icon font download over 1 674 icons of android in svg psd png eps format or as webfonts. When i right click the drawable folder in android studio and choose new vector asset it drops the vector image xml in my drawable folder.
Largeicon must be a bitmap and my drawables are vector images the new feature in android see this link the problem is when i try to decode a resource that is a vector image i get a null returned. Inside android studio right click on your drawable folder new vector asset. This will open up the android studio vector asset generator. However if i use apktool to unpack the apk that gets built i see that the xml files are in drawable anydpi v21 and scale correctly on api 21 devices.
Open build gradle in app module add the below line inside defaultconfig block. Android 5 0 api level 21 was the first version to officially support vector drawables with vectordrawable and animatedvectordrawable but you can support older versions with the android support library which provides the vectordrawablecompat and animatedvectordrawablecompat classes.