android - 构建变体风味维度未覆盖的矢量可绘制对象
问题描述
我有一个带有基本品牌和多个白标品牌以及多个服务器目标的应用程序。在我的应用程序的 build.gradle 中,风味定义为:
flavorDimensions("server", "whitelabel")
在我src/main/res/drawable
的基础品牌中,我有一个 logo.xml VectorDrawable,它被覆盖在src/whitelabel1/res/drawable
.
当我的应用程序的 build.config 包含vectorDrawables.useSupportLibrary = true
正确的 logo.xml 时,将在我的 ImageView 中使用。如果我从 Whitelabel1的 apk 中删除useSupportLibrary
ImageView 呈现logo.xmlmain
<ImageView
android:id="@+id/imageLogo"
android:layout_width="@dimen/viewXS"
android:layout_height="wrap_content"
android:layout_margin="@dimen/marginXS"
android:adjustViewBounds="true"
android:padding="@dimen/marginXS"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_logo" />
解决方案
它也发生在我身上。只有在 defaultconfig 中写入此 vectorDrawables.useSupportLibrary = true 之后。矢量资源是从风味源集文件夹中挑选的。
推荐阅读
- javascript - 无论如何,NodeJS 都会抛出 `UNABLE_TO_VERIFY_LEAF_SIGNATURE`
- javascript - 悬停单独的 div 时需要显示类
- html - 在导航栏中响应地对齐网站图标
- reactjs - 反应显示工作进度
- javascript - 单击其中一个部分时如何关闭导航栏?
- windows - 高亮指针位置
- amazon-web-services - AWS Firehose 使用哪个哈希函数?
- python - 我需要为烧瓶和其他几个库创建一个 docker-compose 吗?
- python - 如何使用scrapy,xpath,python在锚标记中获取文本和href值
- php - PHP致命错误:require():无法打开所需的'vendor/phpmailer/phpmailer/src/Exception.php'