NativeScript 中 DIV 的替代品是什么? [英] What is alternative of DIV in NativeScript?
问题描述
NativeScript 中 DIV 的替代品是什么?
What is alternative of DIV in NativeScript?
如何使用块内嵌内容?
推荐答案
在浏览器中,行为 div
由 display
CSS 属性决定.
Within Browser the behaviour div
is determined by display
CSS attribute.
例如,默认情况下,它是 block
和垂直的,类似于 StackLayout
将 orientation
设置为 vertical
.当您将其设为 inline
时,这更像是一个水平布局,因此同样可以将 StackLayout
与 orientation
设置为 horizontal
>.
For example, by default it's block
and vertical which is similar to StackLayout
with orientation
set to vertical
. When you make it inline
, that's more like a horizontal layout, so again could be StackLayout
with orientation
set to horizontal
.
还有 flex
,我们在 NativeScript 中也有一个等价物,FlexboxLayout
.如果在 div
上将 position
设置为 absolute
,则可以将其与 NativeScript 中的 AbsoluteLayout
进行比较.
There is again flex
, we also have an equivalent in NativeScript, the FlexboxLayout
. If you set position
to absolute
on div
, it can be compared to AbsoluteLayout
in NativeScript.
在 NativeScript 中还有 GridLayout
、WrapLayout
和 DockLayout
用于各种用途.
There is also GridLayout
, WrapLayout
, and DockLayout
in NativeScript that serves various purposes.
所以这里 div
的替代方案完全取决于你正在寻找什么样的 UI/布局/你在网络上如何精确地设置 div
的样式.
So the alternative for div
here totally depends on what kind of UI / layout you are looking for / how exactly you have styled the div
on web.
如果您是初学者,https://www.nslayouts.com/ 是一个好的开始了解有关 NativeScript 布局的所有信息.
If you are beginner, https://www.nslayouts.com/ is a good start to know all about NativeScript layouts.
这篇关于NativeScript 中 DIV 的替代品是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!