How can I change the colour of the toolbar in a FireMonkey mobile application

六月ゝ 毕业季﹏ 提交于 2019-12-12 01:51:25

问题


I'm using Delphi XE7 for developing mobile application. And how can I change the colour of the TToolbar component in Firemonkey mobile application? I can not find the option in the Object Inspector. Is there any other option to change the colour of this component. And I'm targeting Android platform.


回答1:


Method #1: In Firemonkey most components can be contained within most other components. Place a TRectangle inside of your TToolBar component. Align it to Contents. Change the Fill color to the color you want. Change the Stroke.Kind property to None. Done.

Method #2: You can also do this by modifying the style. Drop the TToolBar on the form. Right click it and select Edit Custom Style.... You should see a toolbar1style1: TStyleObject in the Struction window. Find TRectangle in the Tool Palette. Drag and drop the TRectangle onto the toolbar1style1 line in the Structure window. It should add a TRectangle to your style. Set the Align to Contents. Set the Fill color to what you want. Set the Stroke.Kind to None. Apply and Close. Done.

It will create a custom TStyleBook on your form and your Toolbar should be the Fill color. This may be a less cluttered way than the first method. But could conflict with loading Premium styles into the TStyleBook. Therefor I think the first method is more forward compatible and more maintainable.




回答2:


TintColor is the property that you are looking for




回答3:


If your target is the Android platform, I think you can use the TintColor property. I have tested the behaviour in Delphi 10.1 Berlin, and it does work correctly. Please note that the TintColor property is currently only available for mobile platforms (iOS and Android).



来源:https://stackoverflow.com/questions/28852006/how-can-i-change-the-colour-of-the-toolbar-in-a-firemonkey-mobile-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!