Image 组件 src 设置 svg 文件,模拟器运行直接崩溃。loading.svg 文件放在了 resources/base/media 目录下;代码如下:
@Entry
@Component
struct Meeting {
build() {
Column(){
Image($r("app.media.loading"))
}
}
}
svg 文件内容如下:
<svg width="400px" height="400px" viewBox="25 25 50 50" class="circular" version="1.1" xmlns="http://xxx" xmlns:xlink="http://xxx">
<circle cx="50" cy="50" r="20" fill="none" stroke="#409EFF" stroke-dasharray="90,150" stroke-dashoffset="0" stroke-width="2" stroke-linecap="round">
<animate attributeName="stroke-dasharray" dur="1.5s" repeatCount="indefinite" values="1,200;90,150;90,150" />
<animate attributeName="stroke-dashoffset" dur="1.5s" repeatCount="indefinite" values="0;-40;-120" />
</circle>
</svg>
svg中不支持animate组件:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-image-0000001815927572
可以尝试用gif的图片代替