Nativescript中的div等效元素是什么

时间:2015-12-23 16:08:58

标签: nativescript

我正在尝试包装一些元素来提供样式,我没有看到任何可以用作容器的元素。

在这种情况下应该使用什么?

另外请链接到Nativescript中可用的css属性,因为我无法找到可用的css属性列表。

2 个答案:

答案 0 :(得分:4)

虽然样式元素很有用,但我认为您的问题的答案是使用StackLayoutGridLayout,具体取决于您想要做什么。

答案 1 :(得分:1)

StackLayoutGridLayout是常用的,但不是最佳实践。嵌套许多StackLayoutGridLayout会降低应用程序的性能,因此请谨慎使用。经常使用Label。另外,一个方便的技巧是使用FormattedString来嵌套一些成对的元素。

示例:

<Button class="-primary p-8">
    <FormattedString>
        <Span text="&#xf007;" class="fas t-18"></Span>
        <Span text=" Different " color="red"></Span>
        <Span text="colors in "></Span>
        <Span text=" Button " backgroundColor="green" color="whitesmoke"></Span>
    </FormattedString>
</Button>

https://docs.nativescript.org/angular/ui/ng-components/formatted-string