关于margin属性设置参考文档https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-universal-attributes-size-V5\#示例这里是简易demo@Entry @Component struct Index { @State message: string = 'Hello World'; build() { RelativeContainer() { Text(this.message) .id('HelloWorld') .fontSize(50) .fontWeight(FontWeight.Bold) .margin({ top:70, left:20, right:5, bottom:5 }) .border({ width: 5, color: 0x317AF7, radius: 10, style: BorderStyle.Dotted }) } .height('100%') .width('100%') } }
关于margin属性设置参考文档
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-universal-attributes-size-V5\#示例
这里是简易demo