Android Studio的矢量资产导入中的更改

时间:2019-12-14 09:51:57

标签: android android-studio

伙计们,我注意到当我在最近版本中使用Android Studio的矢量资产导入来导入SVG时,得到的图像比以前小。这是一个示例:

之前导入的图像:

<vector android:height="24dp" android:viewportHeight="240"
    android:viewportWidth="240" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#d82727"
        android:pathData="m220,194c0,-7.236 -2.487,-13.342 -7.688,-18.312 -4.975,-4.975 -11.081,-7.688 -18.312,-7.688s-13.342,2.487 -18.312,7.688 -7.688,11.306 -7.688,18.312c0,7.236 2.487,13.342 7.688,18.312 5.201,5.201 11.306,7.688 18.312,7.688 7.236,0 13.342,-2.487 18.312,-7.688 5.201,-4.975 7.688,-11.081 7.688,-18.312m-17.642,-14.248 l5.88,6.106 -8.366,8.366 8.366,8.366 -5.88,5.88 -8.366,-8.366 -8.366,8.366 -6.106,-5.88 8.366,-8.366 -8.366,-8.366 6.106,-6.106 8.366,8.366z" android:strokeWidth="2.261"/>
</vector>

Old image

现在已导入相同的图像:

<vector android:height="24dp" android:viewportHeight="240"
    android:viewportWidth="240" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#d82727"
        android:pathData="m223,201c0,-5.287 -1.817,-9.748 -5.617,-13.38 -3.635,-3.635 -8.096,-5.617 -13.38,-5.617s-9.748,1.817 -13.38,5.617 -5.617,8.261 -5.617,13.38c0,5.287 1.817,9.748 5.617,13.38 3.8,3.8 8.261,5.617 13.38,5.617 5.287,0 9.748,-1.817 13.38,-5.617 3.8,-3.635 5.617,-8.096 5.617,-13.38m-12.89,-10.41 l4.296,4.461 -6.113,6.113 6.113,6.113 -4.296,4.296 -6.113,-6.113 -6.113,6.113 -4.461,-4.296 6.113,-6.113 -6.113,-6.113 4.461,-4.461 6.113,6.113z" android:strokeWidth="1.652"/>
</vector>

New image

我不知道何时会发生此更改,但是有什么方法可以像以前一样导入具有类似比例的图像?我以某种方式不喜欢编辑/导入所有图像以获得与以前相似的结果。

1 个答案:

答案 0 :(得分:0)

预览部分只是一个演示。您的图片没有改变

但是您可以给向量指定宽度和高度 这对您没有帮助吗?

<vector android:height="{custom size}" android:viewportHeight="240"
        android:viewportWidth="240" android:width="{custom size}" 

xmlns:android="http://schemas.android.com/apk/res/android">
        <path android:fillColor="#d82727"
            android:pathData="m223,201c0,-5.287 -1.817,-9.748 -5.617,-13.38 -3.635,-3.635 -8.096,-5.617 -13.38,-5.617s-9.748,1.817 -13.38,5.617 -5.617,8.261 -5.617,13.38c0,5.287 1.817,9.748 5.617,13.38 3.8,3.8 8.261,5.617 13.38,5.617 5.287,0 9.748,-1.817 13.38,-5.617 3.8,-3.635 5.617,-8.096 5.617,-13.38m-12.89,-10.41 l4.296,4.461 -6.113,6.113 6.113,6.113 -4.296,4.296 -6.113,-6.113 -6.113,6.113 -4.461,-4.296 6.113,-6.113 -6.113,-6.113 4.461,-4.461 6.113,6.113z" android:strokeWidth="1.652"/>
    </vector>