How to load custom styles at runtime (不会翻译,只有抄了 )
原文 :http://blogs.embarcadero.com/sarinadupont/2013/10/16/how-to-load-custom-styles-at-runtime/
How to load custom styles at runtime
During my session at CodeRage, I briefly talked about how to load custom styles at runtime. I wanted to elaborate on this topic and provide some detailed steps.
In this example, we are creating a mobile app for iOS and Android that uses the ‘Jet’ Premium Style. I added both styles via the resources dialog in the IDE and used the TStyleManager.LoadFromResource method to load either style at runtime.
When loading custom styles at runtime using the steps below, you don’t see the style at design time.
The first step is to add both styles to resources via ‘Project->Resources and Images’ in the IDE.
Click on ‘Add’, browse to the location of your style (i.e. C:\PremiumPack\iOS) and select the style (i.e. iOSJet.style). Then click on ‘Open’.

Change the name of the Resource Identifier to match the string in your code.

I then created the following OnCreate event for my Form:
procedure TForm1.FormCreate(Sender: TObject);
var
Style: TFMXObject;
begin
Style := nil;
{$IFDEF IOS}
Style := TStyleManager.LoadFromResource(HInstance, ‘iOSJet’, RT_RCDATA);
{$ENDIF}
{$IFDEF ANDROID}
Style := TStyleManager.LoadFromResource(HInstance, ‘AndroidJet’, RT_RCDATA);
{$ENDIF}
if Style <> nil then
TStyleManager.SetStyle(Style);
end;
At runtime, on my iOS device, I see the iOSJet style, and on my Android device, I see the AndroidJet style.
Sincerely,
Sarina
How to load custom styles at runtime (不会翻译,只有抄了 )的更多相关文章
- vue的采坑之旅--vue-cli脚手架loader重复--Invalid CSS after "...load the styles": expected 1 selector or at-rule
在使用scss是可能会添加loader,例如 { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'], } 然而当使 ...
- Could not load file using Ranorex runtime : General Questions
如果你将编译好的bin文件夹复制到另一个未安装Ranorex程序的电脑上运行遇到如下错误信息 Could not load file or assembly 'Ranorex.Core, Versio ...
- 升级tensorflow1.0到1.3,报错ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory Failed to load the native TensorFlow runtime.
先定位问题,发现在 /usr/local/cuda/include/ /usr/local/cuda/lib64/ 下面只有 libcudnn.so.5 因此,只要下载cudnn6.*版本的文件分别覆 ...
- Net Core 5.0 部署IIS错误-500.31-Failed to load ASP.NET Core runtime
Windows Server 2008 R2不支持.net core 3.0版本及以后更新的各个版本. 面对如上图提示,第一想到的就是服务器安装的SDK或者hosting版本有问题,第一时间检查了安装 ...
- Spring Data JPA教程, 第三部分: Custom Queries with Query Methods(翻译)
在本人的Spring Data JPA教程的第二部分描述了如何用Spring Data JPA创建一个简单的CRUD应用,本博文将描述如何在Spring Data JPA中使用query方法创建自定义 ...
- Happening in delphi world
Happy New Year! Delphi XE5 Update 2 Recent VCL enhancements New product features for old product use ...
- 理解Objective-C Runtime(四)Method Swizzling
Objective-C对象收到消息之后,究竟会调用何种方法需要在运行期间才能解析出来.那你也许会问:与给定的选择子名称相应的方法是不是也可以在runtime改变呢?没错,就是这样.若能善用此特性,则可 ...
- Cocos Creator 资源加载流程剖析【三】——Load部分
Load流程是整个资源加载管线的最后一棒,由Loader这个pipe负责(loader.js).通过Download流程拿到内容之后,需要对内容做一些"加载"处理.使得这些内容可以 ...
- check whether the crystal report runtime is exists 检查crystalreport运行时是否存在
1. Try Dim rptDoc As New CrystalDecisions.CrystalReports.Engine.ReportClass() Dim rptView As New Cry ...
随机推荐
- BFS 路径记录
有一迷宫 N*M,要求输出可通行的最短路径. 可以先倒着 BFS 一遍迷宫,这样 dis[] 数组储存的就是各点到迷宫终点的最短距离. 然后再从起点开始 BFS 一遍 dis[] ,只要满足 dis[ ...
- WIFI 万能钥匙万玉权:团队之中要有跨三界之外的“闲人” [转]
在团队规模较小时,很多事情都可以变得特别简单.比如架构的选择,大部分情况下,最初的架构越简单越好,随着业务的演进,架构才不断完善. 连尚网络经历了从几人到上百人的管理过程,其自主创新研发的产品 W ...
- xss之cookie窃取
一.窃取cookie有什么用? cookie相当于一个身份证 有了管理员的cookie我们不需要帐号密码就可以登陆 二.反射型xss有存贮型xss什么区别? 反射 xss 和服务器没有交互 只能用一 ...
- 汇编语言debug入门
进入windows操作系统,因为我的虚拟机用的是win7 64位,所以装了一个Dos Box 的软件来执行这些指令. 输入debug回车,这样就进入了debug模式. 1: 输入 -r 查看或者修改寄 ...
- mvvm框架
了解mvvm框架吗 vue.js react.js angular.js 谈谈你对mvvm的认识 mvc View :用来把数据以某种方式呈现给用户 Model :其实就是数据 Controller ...
- OO课程中IDEA相关插件的使用
写在前面 由于OO课程博客作业的需要分析代码的复杂度并绘制UML图,但是课件上推荐的分析工具(http://metrics.sourceforge.net )经过自己几个小时的折腾还是没有安装成功 ...
- letCode-2
letCode第二题题目如下: 给出两个 非空 的链表用来表示两个非负的整数.其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字. 如果,我们将这两个数相加起来,则 ...
- java中有关初始化的问题
在类的内部,变量定义的先后顺序决定了初始化顺序,即使变量定义分散在方法定义之外,它们依旧会在任何方法(包括构造器)被调用之前得到初始化 其中初始化的顺序先是静态对象,其后是非静态对象 例如: clas ...
- 运维grep语法
grep的语法和用法 grep命令的格式: grep [options] PATTERN [FILE] 其中:1,pattern是用正则表达式书写的模式.2,FILE是要查找的文件,可以是用 ...
- mysql中外键的创建与删除
外键的创建 方法1:创建表的时候设置(外键名随机生成) 1.前提条件,必须要有一个主表,这里设为persons 2.主表中必须设置主键字段primary key,这里设为id_p //创建数据库dat ...