具有Drawcolor的矢量Drawable不支持低于API 24

问题描述 投票:0回答:1

图像的矢量可绘制对象包含渐变颜色,对于低于API版本24的图像,它不在imageview中显示,我正在使用Android-Studio 3.1

android vector gradient drawable android-drawable
1个回答
0
投票
  1. 确保在模块的build.gradle中具有此名称:

    vectorDrawables.useSupportLibrary = true

  2. 如果您使用androidX,请在xml中将其用于ImageView:

    <androidx.appcompat.widget.AppCompatImageView ... />

  3. 设置这样的图像:

    app:srcCompat="@drawable/image"应用程序命名空间在哪里:xmlns:app="http://schemas.android.com/apk/res-auto"

© www.soinside.com 2019 - 2024. All rights reserved.