//背景,实现类似于.9图
@Builder
BubbleBackground() {
Image($r('app.media.bg_made'))
.objectFit(ImageFit.Fill)
.resizable({
slice: {
left: px2vp(40),
right: px2vp(40),
top: px2vp(40),
bottom: 1,
}
})
.width("100%")
.height("100%")
}
Stack({ alignContent: Alignment.Bottom }).background(this.BubbleBackground())
加载总是慢一步,有时候还会出现加载不出来
自定义背景渲染会有一定延迟,不能响应事件,不能进行动态更新。该属性不支持嵌套使用,且不支持预览器预览。官方文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-universal-attributes-background-V5\#background10
可以通过通用属性borderImage实现,请参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-universal-attributes-border-image-V5
示例参考如下: