How to set component distance in ArkTs? (Huawei Hongmeng software development) set margin

Let me tell you how to set the distance between components through margin

Example:

 Tight connection between top and bottom two buttons

After setting the margin

 Spacing is generated

code:

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

We need to add the margin attribute to the component UI description

Official related documents - location setting

Documentation center

Guess you like

Origin blog.csdn.net/m0_59069134/article/details/130280360