为什么矢量图像在 API < 24 Android Studio 中表现怪异

问题描述

我试图为我的 android 应用程序制作自定义矢量图像,我找到了一个很好的 pathData 并在 预览 窗口中得到了正确的结果,也得到了除了使用 Android 6.0 (API) 的手机以外,我在其他手机上运行该应用程序时结果正确!

这是矢量图像 XML 文件

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="200dp"
    android:height="100dp"
    android:viewportWidth="400"
    android:viewportHeight="200">

    <path
        android:fillColor="#0277BD"
        android:pathData="M0,200 L70,200 A130,130 0 0,1 118,99 L74,45 A200,200 0 0,0 0,200 Z"
        android:strokeWidth="1"
        android:strokeColor="#000" />

    <path
        android:fillColor="#4CAF50"
        android:pathData="M74,45 L118,99 A130,1 200,70 L200,0 A200,0 74,45 Z"
        android:strokeWidth="1"
        android:strokeColor="#000" />

    <path
        android:fillColor="#FFC107"
        android:pathData="M200,0 L200,70 A130,1 265,87.4 L300,26.8 A200,0 200,0 Z"
        android:strokeWidth="1"
        android:strokeColor="#000" />

    <path
        android:fillColor="#FF5722"
        android:pathData="M300,26.8 L265,87.4 A130,1 312.6,135 L373.2,100 A200,0 300,26.8 Z"
        android:strokeWidth="1"
        android:strokeColor="#000" />

    <path
        android:fillColor="#DB1C1C"
        android:pathData="M373.2,100 L312.6,135 A130,1 330,200 L400,200 A200,0 373.2,100 Z"
        android:strokeWidth="1"
        android:strokeColor="#000" />

</vector>```

Here is the Preview
[Preview][1]

Here is the output on Android 6.0 phone
[Output][2]


  [1]: https://i.stack.imgur.com/3mTaO.png
  [2]: https://i.stack.imgur.com/xXTnv.png

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)