Android – setting vector drawable in ImageView causes the application in the old SDK to crash
•
Android
I used vector drawable in image SRC, as shown below:
<ImageView
android:id="@+id/isSold"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:visibility="gone"
app:srcCompat="@drawable/ic_soldout_24px"
tools:ignore="MissingPrefix"/>
I also add these to the list:
defaultConfig {
vectorDrawables.useSupportLibrary=true
}
I used the compiler 'com. Android. Support: appcompat-v7: 23.2.1'
But my application crashes in the old SDK and displays the message that the error caused the ImageView class
resolvent:
Use android.support.v7.widget.appcompatimageview instead of ImageView:
<android.support.v7.widget.AppCompatImageView
android:id="@+id/isSold"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:visibility="gone"
app:srcCompat="@drawable/ic_soldout_24px"
tools:ignore="MissingPrefix"/>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码