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

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.
主站蜘蛛池模板: 奉化市| 清河县| 济宁市| 延吉市| 天镇县| 海伦市| 札达县| 福鼎市| 佛坪县| 大方县| 湖州市| 格尔木市| 惠安县| 西和县| 七台河市| 炉霍县| 武汉市| 高台县| 龙南县| 沐川县| 东阿县| 大港区| 安庆市| 青阳县| 双峰县| 乾安县| 西乡县| 澜沧| 台前县| 阿勒泰市| 九龙城区| 朝阳市| 崇文区| 绥棱县| 德兴市| 西青区| 桓仁| 呼伦贝尔市| 广州市| 抚宁县| 武夷山市|