ArkTs中如何设置组件距离?(华为鸿蒙软件开发)设置margin

下面让我来告诉你如何通过margin设置组件间的距离

实例:

 顶部与下面的两个按钮之间紧密相连

设置margin后

 产生了间隔

代码:

Row(){
    Button('刷词条', { type: ButtonType.Capsule, stateEffect: true })
        .backgroundColor('#FFFFFF').width('40%').height('5%').fontColor('#000000')
    Button('抽词条', { type: ButtonType.Capsule, stateEffect: true })
         .backgroundColor('#FFFFFF').width('40%').height('5%').fontColor('#000000')
}.margin({top:'10'})//--------具体顶部10

我们需要在组件UI描述加上margin属性

扫描二维码关注公众号,回复: 15027574 查看本文章

官方相关文档-位置设置

文档中心

猜你喜欢

转载自blog.csdn.net/m0_59069134/article/details/130280360