Edit Module build.gradle
.
android {
...
defaultConfig {
...
vectorDrawables.useSupportLibrary = true
}
...
}
In layout file, use app:srcCompat
.
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_keyboard_arrow_right_black_24dp" />
Set Vector Drawable to ImageView programatically.
imageView.setImageResource(context, R.drawable.ic_keyboard_arrow_right_black_24dp)
NOTE: Refer Get Drawable Of Vector Resource (with support library backward compatibility).