首先
我注意到在 Android Studio 中创建新项目时会生成 drawable-v24
带有 ic_launcher_foreground.xml
的文件夹图标。
我的问题是:
drawable-v24
中而不是 drawable-v21
文件夹? 其次
另一个生成的 Assets 是
ic_launcher_background.xml
创建于 res/drawable
文件夹,后来被 mipmap-anydpi-v26/ic_launcher.xml
引用.res/drawable
中创建的文件夹而不是 res/drawable-v24
或在 res/drawable-v26
?是由于 mipmap 文件夹的某些性质造成的吗? 最佳答案
VectorDrawable尽管它是从 API-21 引入的,但它在某种程度上集成在 API-24 中。我认为 Google 的开发人员认为 API-24+ 对于自适应图标来说是理想的或稳定的。
比如Nick Butcher(Android设计师+开发者@Google)在他的文章中说:Using vector assets in Android apps (2018 年 12 月 11 日),
- Both nonZero and evenOdd path fillTypes —the two common ways of defining the inside of a shape, often used in SVGs (evenOdd added to platform impl in API 24)
- Gradient & ColorStateList fills/strokes (added to platform impl in API 24)
关于
ic_launcher_background
,仅引用自 mipmap-anydpi-v26/ic_launcher.xml
和 mipmap-anydpi-v26/ic_launcher_round.xml
.我认为只是没有必要阻止直接引用它(它已经通过将 ic_launcher.xml
和 ic_launcher_round.xml
放在 mipmap-anydpi-v26
文件夹中来阻止)。不应该有更深的意义。
关于android - 为什么 Android Studio 在 res/drawable-v24 中创建 ic_launcher_foreground 而在 res/drawable 中创建 ic_launcher_background.xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57326843/