Is That Right To Make Android.view.inflateexception By Using Vector Drawables In Android:background: Line In A Imageview
I am facing android.view.InflateException in my app for some particular devices, in others phone it works fine. But i don't know why. Many others says that this problem occurs for
Solution 1:
Make sure you have added vectorDrawables.useSupportLibrary = true
inside defaultConfig
in app/build.gradle
.
Like
defaultConfig {
vectorDrawables.useSupportLibrary = true
....
}
EDIT 1
In order to support vector
in API less then 21. Also add this in onCreate
method of Activity before setContentView
.
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
Solution 2:
Use color code replace of color name from color.xml in your drawable vector xml like below;
<vectorxmlns:android="http://schemas.android.com/apk/res/android"android:width="24dp"android:height="24dp"android:viewportWidth="24.0"android:viewportHeight="24.0"><pathandroid:fillColor="#4396e6"android:pathData="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
Post a Comment for "Is That Right To Make Android.view.inflateexception By Using Vector Drawables In Android:background: Line In A Imageview"