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 ...
随机推荐
- Probability和Likelihood的区别
Bayes for Beginners: Probability and Likelihood 好好看,非常有用. 以前死活都不理解Probability和Likelihood的区别,为什么这两个东西 ...
- WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! --主机密钥验证失败
1.错误出现在更换服务器操作系统后,使用ssh指令连接服务器时报错:ECDSA主机密钥发生改变,导致主机密钥验证失败! 2.解决方式一 使用指令:$ ssh-keygen -R 主机IP 如:$ s ...
- MVC 简介
是AOP (Aspect-Oriented Programming.面向侧 面的程序设计或面向方面的程序设计,是对面向对象程序设计的改进和扩展)内的概念 当 一 件事被细分为各个单元后,各个单元的复 ...
- SpringBoot使用CORS解决跨域请求问题
什么是跨域? 同源策略是浏览器的一个安全功能,不同源的客户端脚本在没有明确授权的情况下,不能读写对方资源. 同源策略是浏览器安全的基石. 如果一个请求地址里面的协议.域名和端口号都相同,就属于同源. ...
- day72 关于rbac组件的小部分面试题
rbac的权限组件 基于角色的权限控制 1.什么是权限? url代表的就是一个权限 2.如何实现权限的控制? 表结构 以我们讲的课的内容为例 菜单表: - title 标题 - icon 图标 ...
- day057 基于对象和基于双下划线的多表查询
单表查询和多表查询的添加与查询 上述关系:author-authordetail是一对一的关系(外键在author上名为authors), book-publis ...
- Forth 词典和词汇
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- Linux Nginx Web环境安装SSL证书后强行指向HTTPS方法
如今我们越来越多的网站需要使用SSL证书,尤其是一些购物类网站,用户交互类网站使用居多.安装方法也很简单,我们可以根据自己的服务器是NGINX还是APACHE进行安装,但是在安装之后,默认的HTTP和 ...
- ionic2一个需求模块的文件该是这样子的
1.组件文件夹的文件 除了index.ts 其他文件为各个页面组件文件 2.index.ts的代码如下 import {SecurityFinance} from "./security-f ...
- find: paths must precede expression问题及解决
用find命令查找时 例如命令 会出错,查文档找出 find: paths must precede expression Usage: find [-H] [-L] [-P] [-Olevel] [ ...