Step 13: Margins and Paddings

介绍

Our app content is still glued to the corners of the letterbox. To fine-tune our layout, we can add margins and paddings to the controls that we added in the previous step.

1.练习效果

Step 13: Margins and Paddings - 第1张  | 优通SAP

2.源码

You can view and download all files at Walkthrough – Step 13.

webapp/view/App.view.xml

To layout the panel, we add the CSS class sapUiResponsiveMargin that will add some space around the panel. We have to set the
width of the panel to auto since the margin would otherwise be added to the default width of 100% and exceed the page
size.

If you decrease the screen size, then you can actually see that the margin also decreases. As
the name suggests, the margin is responsive and adapts to the screen size of the
device. Tablets will get a smaller margin and phones in portrait mode will not get a
margin to save space on these small screens.

Margins can be added to all kinds of controls and are available in many different
options. We can even add space between the button and the input field by adding
class sapUiSmallMarginEnd to the button.

To format the output text individually, we remove the description from the input
field and add a new Text control with the same value. Here we also
use a small margin to align it with the other content. Similarly, we could add the
standard padding classes to layout the inner parts of container controls such as our
panel, but as it already brings a padding by default, this is not needed here.

3.Conventions

  • Use the standard SAPUI5 CSS
    classes for the layout if possible.

     

留下一个回复

你的email不会被公开。

15 − eight =