If you want to use vector drawables (less OR greater than API 21) just do the following:
Set the image programmatically (e.g. in your activity):
imageView.setImageResource(R.drawable.ic_left_arrow_blue);
or by XML:
app:srcCompat="@drawable/your_vector_name"
In your app's build.gradle
you need to include:
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
And for vector support for less then API 21, add the following to onCreate
:
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…