Skip to content

Instantly share code, notes, and snippets.

@iniyanmurugavel
Last active June 12, 2020 12:09
Show Gist options
  • Select an option

  • Save iniyanmurugavel/9beb8ec71363873cc831ca338fae882a to your computer and use it in GitHub Desktop.

Select an option

Save iniyanmurugavel/9beb8ec71363873cc831ca338fae882a to your computer and use it in GitHub Desktop.
Vector Support Library
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
onCreate ()
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
For all xml views in which you are setting a vector drawable replace
android:src
with
app:srcCompat
and in the code replace this:
imageView.setImageResource(...);
I implemented ‘AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);’ in the Activity with ‘vectorDrawables.useSupportLibrary = true’ on API Level 23.4.0, however VectorDrawables still crashes the app on pre-Lollipop devices.
Hopefully AppCompat will fix this in the next library release. Very much looking forward to saving a ton of time with VectorDrawables.
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
onCreate ()
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
For all xml views in which you are setting a vector drawable replace
android:src
with
app:srcCompat
and in the code replace this:
imageView.setImageResource(...);
I implemented ‘AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);’ in the Activity with ‘vectorDrawables.useSupportLibrary = true’ on API Level 23.4.0, however VectorDrawables still crashes the app on pre-Lollipop devices.
Hopefully AppCompat will fix this in the next library release. Very much looking forward to saving a ton of time with VectorDrawables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment