在HarmonyOS NEXT开发中Stack 里 align不生效?问题描述
@Entry
@Component
struct Index {
icon: ResourceStr = $r("app.media.startIcon")
build() {
Stack() {
Image(this.icon)
.width(30)
.height(30)
.align(Alignment.TopStart)
Image(this.icon)
.width(30)
.height(30)
.align(Alignment.TopEnd)
Image(this.icon)
.width(30)
.height(30)
.align(Alignment.BottomStart)
Image(this.icon)
.width(30)
.height(30)
.align(Alignment.BottomEnd)
}.width("100%")
.height("100%")
}
}
align设置容器元素绘制区域内的子元素的对齐方式。只在Stack、Button、Marquee、StepperItem、text、TextArea、TextInput、FolderStack中生效
使用弹性布局(Flex),参考代码:
参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides...