0
我開發了一個示例代碼,其中我創建了一個窗口小部件,其中只添加了一個視圖,並在其中添加圖像視圖。當我直接從控制器的tss應用樣式時它工作得很好,但是當使用「formFactor」時它不起作用。澄清相同的請檢查代碼放在這裏。Titanium Appcelerator合金不支持窗口部件的formFactor樣式
您可以創建一個新的合金項目和測試相同與下面的代碼:
注:所有的依賴關係都包含在config.json
widget實現:
widget.xml
<Alloy>
<View id="section" class="section"></View>
</Alloy>
widget.tss
".section":{
backgroundColor: 'red',
layout : 'vertical'
},
widget.js
var args = arguments[0] || {};
$.section.applyProperties(args);
$.setData = function(view) {
$.section.add(view);
}
Codin g下索引頁
Index.xml
<Alloy>
<ScrollView class="baseView">
<Widget id="contentView" class="contentView" src="com.investis.scrollablesection"></Widget>
</ScrollView>
</Alloy>
Index.tss
".contentView [formFactor=handheld]":{
backgroundColor: 'green',
width: Ti.UI.FILL,
height: Ti.UI.SIZE
}
Index.js
var imgView = Ti.UI.createView({
backgroundColor: 'yellow',
top: 20,
left: 0,
right: 0,
width: Ti.UI.FILL,
height: Ti.UI.SIZE
});
$.contentView.setData(imgView);
同樣的事情工作,如果我從.contentView
在Index.tss
SDK:3.2.1,iOS:7,在模擬器中,不工作formFactor –