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 ...
随机推荐
- MVC实战之排球计分(八)——软件制作总结
此系列博客目的是制作一款排球计分程序.这系列博客将讲述此软件的 各个功能的设计与实现.到这篇博客,此系列博客就算是结束了. 在最后的这篇博客里 我们来做一些总结. 一,制作此程序,我们使用的是MVC框 ...
- git提交代码到码云详解
一.为什么不用github而使用码云? 私有——免费,速度快 二.怎么用? 1.下载安装好git. 2.去码云官网注册个账号.官网:https://git.oschina.net/ 3.创建项目.项目 ...
- tcp滑动窗口详解(2)
http://blog.csdn.net/yujun00/article/details/636495 ARQ与滑动窗口概念 滑动窗口协议,是TCP使用的一种流量控制方法.该协议允许发送方在停止并等 ...
- redis可执行文件说明
redis-server :redis服务器 redis-cli :redis命令客户端 redis-benchmark :redis性能压测工具 redis-check-dump ...
- Forth 输入流处理
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- Linux下安装Julia1.0.0
MIT正式发布编程语言Julia 1.0:Python.R.C++三合一! 由于官方文档提示中安装的不是最新的Julia版本,官方的0.7版本安装方法为: ...
- mkpasswd命令
全称mkpasswd make password(用来生成密码的一个工具):随机生成一些高强度的密码,默认生成9位由大小写字母,特殊符号和数字的密码 [root@master ~]# yum inst ...
- SpringCloud系列------Eureka-Server
一.概述: Spring Cloud针对服务注册与发现,进行了一层抽象,并提供了三种实现:Eureka , Consul , Zookeeper 本篇文章只对Eureka 进行介绍: (部分内容引用 ...
- wire [7:0] regAddr; 理解
首先要指出的是wire[7,0]a和wire[8,1]a这样的表达在verilog中是错误的,应该写成wire[7:0]a和wire[8:1]a wire[7:0]a表示定义了一个wire型数据,该数 ...
- WCF分布式服务1-核心概念
参考msdn library for WCF Windows Communication Foundation (WCF) 是用于构建面向服务的应用程序的框架. 借助 WCF,可以将数据作为异步消息从 ...