SAPUI5 - Vertical layout gravity

15,977

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

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

Share:
15,977
miskohut
Author by

miskohut

Updated on June 09, 2022

Comments

  • miskohut
    miskohut almost 2 years

    i have several elements on screen in xml file

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