#鸿蒙通关秘籍#如何通过RelativeContainer设置上下边框对齐?

HarmonyOS
2024-12-13 12:33:43
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
CPM蓝海鲸歌

上下边框对齐通过alignRules的top或bottom属性设置,选择VerticalAlign.Top、VerticalAlign.Center、VerticalAlign.Bottom等对齐位置。

bash @Entry @Component struct ArkUIClubTest { build() { Column({space: 10}) { RelativeContainer() { Text("Bottom") .fontSize(25) .width(120) .height(40) .backgroundColor("#bbccaa") .alignRules({ bottom: { anchor: "container", align: VerticalAlign.Bottom } }) .id("test") } .width("100%") .height(90) .backgroundColor(Color.Pink) } .width("100%") .height("100%") .backgroundColor("#aabbcc") .padding({left: 50, top: 50, right: 50, bottom: 10}) } }

分享
微博
QQ
微信
回复
2024-12-13 13:46:49
相关问题
怎么给组件设置下边框
7212浏览 • 1回复 待解决
RelativeContainer组件auto对齐规则
538浏览 • 1回复 待解决