NativeScript 中 DIV 的替代品是什么? [英] What is alternative of DIV in NativeScript?

查看:33
本文介绍了NativeScript 中 DIV 的替代品是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NativeScript 中 DIV 的替代品是什么?

What is alternative of DIV in NativeScript?

如何使用块内嵌内容?

推荐答案

在浏览器中,行为 divdisplay CSS 属性决定.

Within Browser the behaviour div is determined by display CSS attribute.

例如,默认情况下,它是 block 和垂直的,类似于 StackLayoutorientation 设置为 vertical.当您将其设为 inline 时,这更像是一个水平布局,因此同样可以将 StackLayoutorientation 设置为 horizo​​ntal>.

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 中还有 GridLayoutWrapLayoutDockLayout 用于各种用途.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆