我在图像src中使用了Vector Drawable,如下所示:
<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"/>
我还添加了这些来体现:
defaultConfig {
vectorDrawables.useSupportLibrary=true
}
我用了 compile 'com.android.support:appcompat-v7:23.2.1'
但是我的应用在旧SDK中崩溃,并显示以下消息: Error inflating class ImageView
使用android.support.v7.widget.AppCompatImageView
代替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"/>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句