在视图中添加视图只会使android应用程序崩溃

Adding a view to a view just crashes the android application

本文关键字:视图 android 应用程序 崩溃 添加      更新时间:2023-09-26

我正在使用Kevin Whinnery的Snapost应用程序作为参考(https://github.com/kwhinnery/Snapost/blob/master/1.1.x/Snapost/Resources/app.js),但是当向视图中添加视图时,应用程序就会崩溃。

这是我在应用程序中唯一的代码。

Titanium.UI.setBackgroundColor('#FFF'); 
var viewContainer = Titanium.UI.createView({
    top:0,
    width:320,
    height:420 
});
var home = Titanium.UI.createView({
      top:0,
      width:320,
      height:420,
});
viewContainer.add(home);
var app = Ti.UI.createWindow({
    title:"main window"
});    
app.add(viewContainer);
app.open();

API 1.6似乎有问题,它在API 2.2上运行良好。