Difference between app:srcCompat and android:src in Android’s layout XML

app:srcCompat

is the most foolproof method of integrating vector drawables into your app.Vector drawables allow you to replace multiple png assets with a single vector graphic, defined in XML. While previously limited to Lollipop and higher devices

Note

As of Android Support Library 23.3.0, support vector drawables can only be loaded via app:srcCompat .

you need to add vectorDrawables.useSupportLibrary = true to your build.gradle file

    // Gradle Plugin 2.0+  
 android {  
   defaultConfig {  
     vectorDrawables.useSupportLibrary = true  
    }  
 }  

android:src

Sets a drawable as the content of this ImageView.It will display in
its original size. No automatic scaling .

Leave a Comment