【问题标题】:Why text attribute in SVG file does not appear in Android Studio vector asset XML on asset import为什么 SVG 文件中的文本属性在资产导入时不会出现在 Android Studio 矢量资产 XML 中
【发布时间】:2018-11-19 03:13:56
【问题描述】:

我导入了一个 .svg 文件,其中包含以下 xml

<text class="cls-4" transform="translate(3.08 8.71)">My Text</text>
<text class="cls-4" transform="translate(66.04 94.97) rotate(180)">My Text</text>

通过

作为图片资源进入 Android Studio
File > New > Vector Asset

在新矢量资产的 xml 中,我做了 ctrl+f,但没有找到字符串 My Text,实际上文本不会呈现,因为它在 svg 文件中不存在。

【问题讨论】:

    标签: android android-studio svg


    【解决方案1】:

    我认为 Android Studio 不会以某种方式解释 text 属性。我能够通过将原始 Adob​​e Illustrator 文件中的文本转换为路径,然后将 Illustrator 文件导出为 svg 文件,然后将 svg 图像作为矢量资源导入 Android Studio 来解决该问题;我的问题是在将文本转换为路径之前,我将 Illustrator 文件导出为 svg 格式。

    在 Adob​​e Illustrator 中将文本转换为路径的步骤

    http://reachheadwear.com/illustrator-101-creating-outlines

    【讨论】:

      【解决方案2】:

      这么简单的答案就是你必须为文本创建路径

      使用 InkScape 路径/对象到路径

      完成

      【讨论】:

        猜你喜欢
        • 2016-02-13
        • 2016-01-12
        • 1970-01-01
        • 1970-01-01
        • 2013-10-14
        • 2013-08-20
        相关资源
        最近更新 更多