官术网_书友最值得收藏!

Creating responsive layouts

In this topic, you will learn how to work with responsive layouts in Delphi using FireMonkey (FMX). For the examples, we will use Delphi Tokyo. Let's have a look at the required steps:

  1. To start, open Delphi and create a new project by navigating to File | New | Multi-Device Application-Delphi and select Blank Application:

Adjust the style for Android; for example, for the view, we will continue in the Master view.

Give preference to working in the Master view. During development, if you want to modify views and add new controls to your form, the responsiveness properties will not be inherited. For example, when adding a TButton component to a 4-inch Android view, properties will be lost if you create to modify for a different view, such as iPhone. In the Master view, all the characteristics will be kept, keeping their proportions clear, by the platform.
  1. Add a Toolbar component to your form.
  2. Create two buttons inside Toolbar.
  3. Select the two buttons and align to the left.
  4. Modify the margins to 5 on each property.
  5. Save your project and run the application for a Windows platform.
  6. Then, select the first button that is already configured and modify the StyleLookup property by selecting the cameratoolbutton option. Notice that the button icon is then changed to a specific camera icon.
  7. Add another Toolbar component, but leave it with bottom alignment. In this toolbar, add a button, align it to the right, and change its margins to 5, as in the top buttons. This button will exit the application.
  8. Finally, add a TLayout component to the center of your form so that it fills the empty area and align it when using Client.
  9. Also, modify StyleLookup for the missing buttons. For the button next to the camera, select searchtoolbutton, because, through this, we will search the already-saved images in the device. For the last button, select escapetoolbutton in the StyleLookup property, because, with this button, we will leave the application.
主站蜘蛛池模板: 潮安县| 神农架林区| 陆川县| 丰都县| 长沙市| 扎兰屯市| 岳西县| 高雄县| 杭锦后旗| 启东市| 凤山市| 亚东县| 松江区| 宁强县| 长宁区| 礼泉县| 雷州市| 永登县| 宜都市| 兴城市| 临西县| 图片| 都安| 九龙县| 义乌市| 密山市| 安顺市| 通许县| 凤城市| 阿鲁科尔沁旗| 奉新县| 墨脱县| 新巴尔虎左旗| 江永县| 廊坊市| 玉屏| 大宁县| 海阳市| 丰顺县| 文成县| 开化县|