gpt4 book ai didi

android:fillType ="evenOdd"在 api 23 中不起作用 - 矢量可绘制任何替代解决方案?

转载 作者:行者123 更新时间:2023-11-30 05:10:29 33 4
gpt4 key购买 nike

任何替代解决方案?

矢量可绘制代码

<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

Attribute fillType is only used in API level 24 and higher (current min is 1) less... (⌘F1)

This check finds attributes set in XML files that were introduced in a version newer than the oldest version targeted by your application (with the minSdkVersion attribute). This is not an error; the application will simply ignore the attribute.

However, if the attribute is important to the appearance or functionality of your application, you should consider finding an alternative way to achieve the same result with only available attributes, and then you can optionally create a copy of the layout in a layout-vNN folder which will be used on API NN or higher where you can take advantage of the newer attribute. Note:

This check does not only apply to attributes. For example, some tags can be unused too, such as the new element in layouts introduced in API 21. Issue id: UnusedAttribute enter image description here

warning

最佳答案

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

最简单的解决方案是:将 minSdkVersion 设置为 24,以便使用 evenOdd 生成图像。

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

关于android:fillType ="evenOdd"在 api 23 中不起作用 - 矢量可绘制任何替代解决方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53838549/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com