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 ...
随机推荐
- 【转】 pthread设置线程的调度策略和优先级
转自:https://www.cnblogs.com/tianzeng/p/9192706.html 线程的调度有三种策略:SCHED_OTHER.SCHED_RR和SCHED_FIFO.Policy ...
- 如何设置在html中保留超链接格式但不实现跳转
---恢复内容开始--- 老师布置了一个任务,要求用户登录或者不登录都会有一个主页(home.jsp),如果登录的话就会跳转至登录界面(login.jsp),在登录界面中有个验证码,还要求有个和很多登 ...
- angular4,6 引入第三方插件的方法
话不多说直入主题,最常见的有三种方式来引用第三方插件,下面以jquery插件及基于JQuery的两款插件:nicescroll和rangeSlider为例. 一.第一种方式:在.angular-cli ...
- day16_python_1124
圈子 圈子是互相影响,走着走着就散了. 道不同不相为谋,与人的认知相关. 圈子如何正向引导? 圈子能决定你的人生走向. 圈子能决定你的格局. 01 昨日内容回顾 序列化模块 将一个数据结构 ----& ...
- JavaScript下实现交换数组元素上下移动例子
// 交换数组元素 var swapItems = function(arr, index1, index2) { arr[index1] = arr.splice(index2, ...
- 架构之路:nginx与IIS服务器搭建集群实现负载均衡(二)
[前言] 在<架构之路:nginx与IIS服务器搭建集群实现负载均衡(一)>中小编简单的讲解了Nginx的原理!俗话说:光说不练假把式.接下来,小编就和大家一起来做个小Demo来体会一下N ...
- js格式化数字
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- [Leetcode 46]全排列 Permutations 递归
[题目] Given a collection of distinct integers, return all possible permutations. 数组的组合情况. Input: [1,2 ...
- Shell脚本的学习笔记一:变量
三种变量: 局部变量:局部变量在脚本或命令中定义,仅在当前shell实例中有效,其他shell启动的程序不能访问局部变量. 环境变量:所有的程序,包括shell启动的程序,都能访问环境变量,有些程序需 ...
- 18-10-08 对Excel 表格添加颜色
#-*- coding:utf-8 -*-#首先注意一个问题 pycharm 中路径符号和Linux 系统一样向左import xlwt def add_color(): #实例化对象 增加sheet ...