我正在尝试为使用两个 VectorDrawables 作为背景和前景的应用程序创建一个自适应图标。但是,从 Illustrator 中制作的 svg 创建的前景矢量无法调整大小或正确放置在图标中。
供将来参考的前景矢量
我根据 Adaptive icon Guidelines中的规范将矢量 viewportheight 和 viewportwidth 设置为 108dp x 108dp ,但这只会导致前景偏移。
<vector android:height="108dp" android:viewportHeight="108"
android:viewportWidth="108" android:width="108dp"
xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
...
</vector>
但是,当 viewportheight 和 viewportwidth 设置为较小的值(例如 50)时,矢量出现在正确的位置但太大了。
<vector android:height="108dp" android:viewportHeight="50"
android:viewportWidth="50" android:width="108dp"
xmlns:aapt="http://schemas.android.com/aapt" xmlns:android="http://schemas.android.com/apk/res/android">
...
</vector>
我是使用 android 的新手,所以我不确定还有哪些其他因素可能导致这种情况。还有另一个类似的问题,但是没有解决抵消效应的原因。