2015-04-15 130 views
3

我有几个屏幕元素在XML文件中SAPUI5 - 垂直布局重心

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

我怎么可以添加类似的布局重心或对齐,我想在屏幕中心这些元素。你能帮我解决吗?谢谢。

回答

2

由于您使用的sap.m库,无论如何,我会建议使用sap.m.VBox控制(或sap.m.HBox对于水平布局) 的VBox不完全一样的VerticalLayout多(你可以指定对齐,对齐在真正灵活的方式

VBoxFlexBoxHBox继承,看到你可以做什么这些例子:https://sapui5.hana.ondemand.com/sdk/explored.html#/entity/sap.m.FlexBox/samples

+0

这是工作,但它是在页面的顶部中间我可以水平和垂直居中。? – miskohut

+1

那么,我已经给你提示了;-)只需嵌入一个'HBox'来在X轴上进行调整和对齐 – Qualiture