Step 18: Icons

介绍

Our dialog is still pretty much empty. Since SAPUI5 is shipped with a large icon font that contains more than 500 icons, we will add an icon to greet our users when the dialog is opened.

1.练习效果

Step 18: Icons - 第1张  | 优通SAP

2.源码

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

webapp/view/HelloPanel.view.xml
We add an icon to the button that opens the dialog. The sap-icon://
protocol is indicating that an icon from the icon font should be loaded. The
identifier world is the readable name of the icon in the icon font.

3.Tip

You can look up other icons using the Icon Explorer tool in the Demo Kit.

To call any icon, use its name as listed in the Icon Explorer in sap-icon://<iconname>.

4.webapp/view/HelloDialog.fragment.xml

In the dialog fragment, we add an icon control to the content aggregation of the
dialog. Luckily, the icon font also comes with a “Hello World” icon that is perfect
for us here. We also define the size of the icon and set a medium margin on it.

5.Conventions

  • Always use icon fonts rather than images wherever possible, as they are
    scalable without quality loss (vector graphics) and do not need to be loaded
    separately.

     

留下一个回复

你的email不会被公开。

17 + 9 =