NativeScript StackLayout 子元素之间有间隙

Dri*_*ans 3 nativescript

我正在使用 NativeScript StackLayout 组件来布局我的元素。

在 StackLayout 的子元素之间创建间隙的最佳方法是什么?

Nic*_*rdu 7

您可以margin在 css 中使用该布局。

在你的 XML 中:

  <StackLayout>
      <Label text="Hey there,"></Label>
      <Label text="world!"></Label>
  </StackLayout>
Run Code Online (Sandbox Code Playgroud)

在你的 css 中:

StackLayout Label {
  margin: 10;
}
Run Code Online (Sandbox Code Playgroud)