首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >特定于平台的模型样式appcelerator

特定于平台的模型样式appcelerator
EN

Stack Overflow用户
提问于 2018-02-13 00:42:55
回答 1查看 79关注 0票数 0

我正在尝试在appcelerator中设置我的应用程序的样式。在tss文件中,我可以根据手机的型号来设置样式吗?".clsview"platform = iphone model=6s有没有提供这样的样式?

EN

回答 1

Stack Overflow用户

发布于 2018-02-13 01:12:19

是的,你可以用很多可能的方式来设计样式。

但首先,您应该看一下这个链接,以熟悉合金样式的工作原理:

合金允许基于true/false值定义特定的样式,如下所示:

代码语言:javascript
复制
// alloy.js
Alloy.Globals.iPhone6s = (OS_IOS && Ti.Platform.osname == "iphone" && Ti.Platform.displayCaps.platformHeight == 667); 

// Since iPhone5s screen size is 640x1136, you can check for platformHeight == 568 as its DP is 2
Alloy.Globals.iPhone5s = (OS_IOS && Ti.Platform.osname == "iphone" && Ti.Platform.displayCaps.platformHeight == 568);  


// in tss
".clsview"[if=Alloy.Globals.iPhone6s] 

".iphone5s"[if=Alloy.Globals.iPhone5s] : {
    backgroundColor : 'cyan'
}

// to apply class only on tablets, use 'formFactor = handheld/tablet'
'.tablet'[formFactor=tablet]:{color:'blue'}
'.phones'[formFactor=handheld]:{color:'red'}

// to use multiple 'if' statements inside tss, you can combine them inside alloy.js
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48751384

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档