

Titanium.UI.setBackgroundColor("#000");
// 创建 tab group
var tabGroup = Titanium.UI.createTabGroup();
//第一件事你要注意当 Tab Groups开始工作的时候
//tab group 函数作为控制 "window"
//每一个 tab 有自己的 window 作为一个单独的运行环境
//要记住的是,你要手动传送数据
//windows 是单独运行的
//我们将创建两个tabs: tours 和 specials
//Tours tab 和 window
var toursWindow = Titanium.UI.createWindow({
title:"Tours",
backgroundColor:"#FFFFFF"
});
var image = Titanium.UI.createImageView({
image:"images/exploreCalifornia.png",
width:96,
height:119,
});
var caption = Titanium.UI.createLabel({
text:"Explore California Tours",
bottom:20,
height:"auto",
width:"auto",
textAlign:"center",
color:"#000000"
});
toursWindow.add(image);
toursWindow.add(caption);
var toursTab = Titanium.UI.createTab({
icon:"tours-tab.png",
title:"Tours",
window:toursWindow //设置tab的window 不是一个变量引用一个窗口
});
//Specials window
var specialsWindow = Titanium.UI.createWindow({
title:"Specials",
backgroundColor:"#FFFFFF",
url:"specials.js" //这是一个参考一个外部js文件,可以作为窗口为这个标签
});
var specialsTab = Titanium.UI.createTab({
icon:"specials-tab.png",
title:"Specials",
window:specialsWindow
});
tabGroup.addTab(toursTab);
tabGroup.addTab(specialsTab);
tabGroup.open();