Nativescript 中的 div 等效元素是什么
What is the div equivalent element in Nativescript
我正在尝试包装一些元素以提供样式,但我没有看到任何可以用作容器的元素。
在这种情况下应该使用什么?
另外 link Nativescript 中可用的 css 属性,因为我找不到可用 css 属性的列表。
虽然样式元素很有用,但我认为您的问题的答案是使用 StackLayout
或 GridLayout
,具体取决于您想要做什么。
StackLayout
或 GridLayout
是常用的,但不是最佳实践。嵌套多个 StackLayout
或 GridLayout
会降低应用的性能,因此请谨慎使用。更频繁地使用 Label
。此外,一个方便的技巧是使用 FormattedString
来嵌套一些成对的元素。
示例:
<Button class="-primary p-8">
<FormattedString>
<Span text="" 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
我正在尝试包装一些元素以提供样式,但我没有看到任何可以用作容器的元素。
在这种情况下应该使用什么?
另外 link Nativescript 中可用的 css 属性,因为我找不到可用 css 属性的列表。
虽然样式元素很有用,但我认为您的问题的答案是使用 StackLayout
或 GridLayout
,具体取决于您想要做什么。
StackLayout
或 GridLayout
是常用的,但不是最佳实践。嵌套多个 StackLayout
或 GridLayout
会降低应用的性能,因此请谨慎使用。更频繁地使用 Label
。此外,一个方便的技巧是使用 FormattedString
来嵌套一些成对的元素。
示例:
<Button class="-primary p-8">
<FormattedString>
<Span text="" 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