javascript SAPUI5 - 垂直布局重力
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29643752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SAPUI5 - Vertical layout gravity
提问by miskohut
i have several elements on screen in xml file
我在 xml 文件中的屏幕上有几个元素
<core:View controllerName="myapp.view.login.login"
xmlns="sap.m" xmlns:core="sap.ui.core"
xmlns:l="sap.ui.layout">
<l:VerticalLayout >
<l:content>
<Input
type="Text"
maxLength="15"
fieldWidth="15px"
placeholder="name"
textAlign="Center">
</Input>
<Input
type="Password"
maxLength="15"
fieldWidth="15px"
placeholder="password"
textAlign="Center">
</Input>
<Button
text="Log in"
press="logIn">
</Button>
</l:content>
</l:VerticalLayout>
</core:View>
how can i add something like layout gravity or align, I want these elements in the center of the screen. Could you help me with that? Thank you.
我如何添加布局重力或对齐之类的东西,我希望这些元素位于屏幕中央。你能帮我解决这个问题吗?谢谢你。
采纳答案by Qualiture
Since you're using the sap.m
library anyway, I would recommend to use the sap.m.VBox
control (or sap.m.HBox
for horizontal layouts)
The VBox
does exactly the same as the VerticalLayout
and more (you can specify alignment, justification in a truly flexible way
由于您sap.m
无论如何都在使用该库,因此我建议您使用sap.m.VBox
控件(或sap.m.HBox
用于水平布局)VBox
与 完全相同VerticalLayout
以及更多(您可以以真正灵活的方式指定对齐方式,对齐方式
The VBox
and HBox
inherit from FlexBox
, see these examples on what you can do: https://sapui5.hana.ondemand.com/sdk/explored.html#/entity/sap.m.FlexBox/samples
在VBox
和HBox
继承FlexBox
,看到你可以做什么这些例子:https://sapui5.hana.ondemand.com/sdk/explored.html#/entity/sap.m.FlexBox/samples