1

如何在 appcelerator 合金项目中使用 TSS 编写字体大小、顶部、高度、宽度的表达式...

'.myLabel': {
    backgroundColor: '#fff',
    height: Ti.Platform.displayCaps.platformHeight / 2,
    width: (Ti.Platform.displayCaps.platformWidth + 50) / 2
}
4

1 回答 1

1

您不能在 TSS 中进行这样的计算。您可以在控制器中执行此操作并将值分配给每个元素,或者在alloy.js 中使用全局变量进行计算并分配该变量。看看这篇博文: https ://www.tidev.io/2014/10/22/how-to-use-expressions-in-tss/

于 2018-11-03T21:35:43.937 回答