Using Vector Assets for Icons in Android Studio 1.4
Since Android Studio 1.4, we can use Vector Assets which was earlier restricted to Lollipop alone. This is more efficient since one drawable which requires multiple instances saved in different density folders will now be replaced by just ONE single vector asset inside res/drawable/
You need to use Gradle 1.4 for this.
'com.android.tools.build:gradle:1.5.0'to your build.gradle file dependencies.
- Add a vector asset by right-clicking res/drawable/ > New > Vector Asset. Android Studio provides a built-in viewer for you to pick your drawable.
- Reference your icon like you usually do. Eg:
Since the icons are black, you may want to tint your ActionBar icons white. You can do so by reference the icon like this:
menu.getItem(index).getIcon() and then use DrawableCompat to tint.
App developer with an eye for design. Loves to create apps with good UI/ UX that doesn’t annoy people. In his spare time, he likes to draw and paint.