我为 Android 应用程序创建了两种风格和二维。口味是免费且高级的,尺寸是默认的和带有附加功能的。我想要的是以下口味:
freeDefault
|---freeWithExtras
premiumDefault
|---premiumWithExtras
withExtras 维度应该基于默认风格,但添加一些更多功能。我还希望 freeWithExtras 版本有一个不同的图标。我创建了一个不同的图标并将其放置在 src/withExtras/res/drawable 文件夹中。另一个(默认)图标位于 src/free/res/drawable 文件夹中。当我运行 freeWithExtras 维度时,使用的图标来自 free/res/drawable 文件夹。如何使上述尺寸使用放置在其 res 文件夹中的图像?我的设置有问题吗?
最佳答案
我假设您的口味/尺寸设置如下所示:
flavorDimensions "mode", "extras"
...
productFlavors {
free {
dimension "mode"
}
premium {
dimension "mode"
}
default {
dimension "extras"
}
withExtras {
dimension "extras"
}
}
您应该能够为您的特定构建变体 freeWithExtras
创建一个源文件夹,它结合了两种风格。然后您可以将图标放入src/freeWithExtras/res
。 The order you specify your flavorDimensions
controls the order in which the flavors are concatenated构建文件夹/构建变体名称。
关于android - 使用不同的图标表示不同的 flavor 维度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48809282/