【发布时间】:2011-12-27 12:06:39
【问题描述】:
我目前正在制作一个模块,它通过滚动视图为您完成了艰苦的工作。当我在 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" 吗?
标签: javascript android iphone ios titanium