代码之家  ›  专栏  ›  技术社区  ›  Akhila Madari

android:fillType=“evenOdd”在api 23-vector drawable中不起作用,是否有其他解决方案?

  •  0
  • Akhila Madari  · 技术社区  · 7 年前

    <vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24">
      <path
          android:pathData="M6.5,22.4235L17.995,22.4235L17.995,10.9285L6.5,10.9285L6.5,22.4235ZM8.068,6.6785C8.068,4.3745 9.943,2.4995 12.247,2.4995C14.551,2.4995 16.426,4.3745 16.426,6.6785L16.426,9.4285L8.068,9.4285L8.068,6.6785ZM11.4971,16.6426C10.7691,16.3456 10.2551,15.6336 10.2551,14.7986C10.2551,13.6996 11.1471,12.8076 12.2471,12.8076C13.3481,12.8076 14.2391,13.6996 14.2391,14.7986C14.2391,15.6336 13.7261,16.3456 12.9971,16.6426L12.9971,19.8826L11.4971,19.8826L11.4971,16.6426ZM17.926,9.4285L17.926,6.6785C17.926,3.5475 15.378,0.9995 12.247,0.9995C9.116,0.9995 6.568,3.5475 6.568,6.6785L6.568,9.4285L5,9.4285L5,23.9235L19.495,23.9235L19.495,9.4285L17.926,9.4285Z"
          android:strokeWidth="1"
          android:fillColor="#000000"
          android:fillType="evenOdd"
          android:strokeColor="#00000000"/>
    </vector>
    

    格拉德尔:

     minSdkVersion = 21
        targetSdkVersion = 28
        compileSdkVersion = 28
    

    min比。。。(F1)

    比应用程序目标的最旧版本更新的版本 应用程序将忽略该属性。

    实现相同结果的替代方法只有 属性,然后可以选择在中创建布局的副本 可以利用较新的属性。注:

    此检查不仅适用于属性。例如,一些标签 也可以不使用,例如引入布局中的新元素 在API 21中。问题编号:联合国大学 enter image description here

    warning

    2 回复  |  直到 7 年前
        1
  •  1
  •   cmoaciopm    7 年前

    我认为根本原因是您将minSdkVersion设置为21,它不支持evenOdd(gradle build会忽略它)。

    或者,您需要将非零的SVG导出为fillType。有关更多详细信息,请参阅 The Mystery of the Disappearing Holes — a gripping tale of using SVG in Android

        2
  •  0
  •   Akhila Madari    7 年前

    <vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24">
      <path
          android:pathData="M6.5,10.9235L17.995,10.9235L17.995,22.385L6.5,22.385L6.5,22.4235ZM8.068,6.6785C8.068,4.3745 9.943,2.4995 12.247,2.4995C14.551,2.4995 16.426,4.3745 16.426,6.6785L16.426,9.4285L8.068,9.4285L8.068,6.6785ZM11.4971,16.6426C10.7691,16.3456 10.2551,15.6336 10.2551,14.7986C10.2551,13.6996 11.1471,12.8076 12.2471,12.8076C13.3481,12.8076 14.2391,13.6996 14.2391,14.7986C14.2391,15.6336 13.7261,16.3456 12.9971,16.6426L12.9971,19.8826L11.4971,19.8826L11.4971,16.6426ZM17.926,9.4285L17.926,6.6785C17.926,3.5475 15.378,0.9995 12.247,0.9995C9.116,0.9995 6.568,3.5475 6.568,6.6785L6.568,9.4285L5,9.4285L5,23.9235L19.495,23.9235L19.495,9.4285L17.926,9.4285Z"
          android:strokeWidth="1"
          android:fillColor="#000000"
          android:strokeColor="#00000000"/>
    </vector>