【问题标题】:Edited Vector Drawable not showing in the app编辑后的 ​​Vector Drawable 未在应用程序中显示
【发布时间】:2017-03-17 11:19:23
【问题描述】:

我删除了this icon SVG,并在 Inkscape 中对其进行了编辑,使双勾图标看起来像 WhatsApp 的。

所以,后来我在 Android Studio 中放了原始的矢量可绘制图标:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:height="24dp"
    android:width="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
    <path android:fillColor="#000" android:pathData="M0.41,13.41L6,19L7.41,17.58L1.83,12M22.24,5.58L11.66,16.17L7.5,12L6.07,13.41L11.66,19L23.66,7M18,7L16.59,5.58L10.24,11.93L11.66,13.34L18,7Z" />
</vector>

然后我将 pathData 替换为在 Inkscape 中编辑的 SVG 路径:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
    <path
        android:fillColor="#000"
        android:pathData="M 0.41,13.41 6,19 7.41,17.58 1.83,12 M 22.24,5.58 11.66,16.2 11,15.5 9.5,17 11.66,19 23.66,7 M 18,7 16.5,5.5 4.5, 17.5 6,19 Z"/>
</vector>

我可以在 Android Studio 预览中看到新图标,但是当我运行应用程序时它不显示。普通图标确实可以正常显示,但这个不正常。

这是我无法理解的奇怪行为,我对矢量图形很陌生。

这是为什么呢?

【问题讨论】:

    标签: android svg vector-graphics inkscape


    【解决方案1】:

    我自己找到了答案。查看原始图标语法,似乎应该使用L 字母给出空格。

    <vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
        <path android:fillColor="#8A000000" android:pathData="M0.41,13.41L6,19L7.41,17.58L1.83,12M22.24,5.58L11.66,16.2L11,15.5L9.5,17L11.66,19L23.66,7M18,7L16.5,5.5L4.5,17.5L6,19Z"/>
    </vector>
    

    现在可以了。有趣的是,我对矢量绘图一无所知,但仍然找到了解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-21
      • 2021-08-25
      • 2016-07-14
      • 1970-01-01
      • 2015-05-01
      相关资源
      最近更新 更多