我目前正在制作一个模块,它使用滚动视图为您完成了艰苦的工作。当我在iPhone模拟器上运行此代码时,它非常完美 - 没有错误。在Android模拟器上,我只看到一个空白的屏幕?Titanium Javascript - 代码适用于iPhone,但不适用于Android?
为什么我只看到一个空白屏幕,我该如何解决? 这里是我的代码:
window = Ti.UI.createWindow({
backgroundColor : 'white'
});
function SuperScrollView(window) {
this.scrollview = Ti.UI.createScrollView({
showVerticalScrollIndicator : true,
height : window.height,
width : window.width,
contentHeight : 'auto'
});
this.view = Ti.UI.createView({
height : 0,
width : window.width
});
this.addElement = function(element) {
var height = this.view.height;
var elementHeight = element.height;
element.top = height;
this.view.add(element);
this.view.height += elementHeight;
height = this.view.height;
this.scrollview.contentHeight = height;
alert(height);
}
this.scrollview.add(this.view);
window.add(this.scrollview);
}
var scrollview = new SuperScrollView(window);
scrollview.addElement(Ti.UI.createView({
width : 200,
height : 500,
backgroundColor : 'blue'
}));
window.open();
你看到一个空白窗口? –
您是否试过Ti.UI.FILL和Ti.UI.SIZE而不是“window.height”? – Norris