居中AdaptiveIcon

时间:2019-06-06 19:39:25

标签: android adaptive-icon

我正在尝试创建一个自适应图标。我已将SVG导入为XML Drawable:

<vector android:height="108dp" android:viewportHeight="172.5"
    android:viewportWidth="172.5" android:width="108dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="@color/white"
          android:pathData="M171.66,128.12a41.87,41.87 0,0 1,0 -83.74,0.84 0.84,0 1,0 0,-1.67A41.88,41.88 0,0 1,129.79 0.84a0.84,0.84 0,1 0,-1.67 0,41.87 41.87,0 0,1 -83.74,0 0.84,0.84 0,1 0,-1.67 0A41.88,41.88 0,0 1,0.84 42.71a0.84,0.84 0,1 0,0 1.67,41.87 41.87,0 0,1 0,83.74 0.84,0.84 0,1 0,0 1.67,41.88 41.88,0 0,1 41.87,41.87 0.84,0.84 0,1 0,1.67 0,41.87 41.87,0 0,1 83.74,0 0.84,0.84 0,1 0,1.67 0,41.88 41.88,0 0,1 41.87,-41.87 0.84,0.84 0,1 0,0 -1.67ZM86.25,128.12a41.87,41.87 0,1 1,41.87 -41.87A41.88,41.88 0,0 1,86.25 128.12Z"/>
</vector>

然后,我尝试使用Asset Studio构建自适应图标。如果使用默认的“背景可绘制”,则图标居中(但未正确缩放)。

enter image description here

但是,如果我将背景切换为颜色,则图标固定在左上方。我究竟做错了什么?为什么背景变化会调整前景的位置?

enter image description here

0 个答案:

没有答案