gpt4 book ai didi

android - Android Vector 中的破折号 stroke-dasharray

转载 作者:太空狗 更新时间:2023-10-29 16:11:39 40 4
gpt4 key购买 nike

如何在 Android Vector Drawable 上添加虚线? Android Vector 似乎不支持来自 svg 的“stroke-dasharray”。还有其他方法吗?我想要虚线的可绘制对象:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="61dp"
android:height="160dp"
android:viewportWidth="61.0"
android:viewportHeight="160.0">
<path
android:pathData="M2,159C6,81.5 38,21 57,4"
android:strokeColor="#FFCF4D"
android:fillColor="#00000000"
android.stroke-dasharray="1"
android:strokeWidth="3"/>
<path
android:pathData="M49,2L59,2L59,12"
android:strokeColor="#FFCF4D"
android:fillColor="#00000000"
android:strokeWidth="3"/>

最佳答案

来自文档: https://developer.android.com/studio/write/vector-asset-studio.html

Strokes and fills Supported:

Strokes, including color, opacity, width, join, cap, dashes, and alignment. Solid color fills and strokes. Stroke and fill colors specified as RGB, Lab, or CMYK.

Conversion details:

If a stroke is dashed, clipped using a clipping base, or uses an alignment different from center, Vector Asset Studio converts it into a fill shape in the vector drawable.

简而言之,Android Vector Drawables 尚不支持虚线笔划。

您可以导入包含虚线笔划的 SVG 文件,但 Vector Asset Studio 会将它们转换为填充形状。

关于android - Android Vector 中的破折号 stroke-dasharray,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45893855/

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