I'm trying to use drawable in textView like this
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/svg_ic_profile_logout"
android:drawablePadding="20dp"
android:drawableStart="@drawable/svg_ic_profile_logout"
android:gravity="center_vertical"
android:onClick="@{viewModel.onLogoutClick}"
android:text="@string/profile_logout"/>
but the icon I using is SVG, it works perfectly fine for API > 21 but got a crash for API level lower than 21.
Add vectorDrawables.useSupportLibrary = true in you app level build.gradle as follows:
//For Gradle Plugin 2.0+
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
Refer to this guide.