您好我正在尝试使用 Titanium Studio 构建一个简单的移动应用程序并面临问题,以从 Android 模拟器中的表视图列表项打开新窗口。这是我在 js 文件中使用的代码。
应用程序.js
var tabGroup = Titanium.UI.createTabGroup();
var win = Titanium.UI.createWindow({
backgroundColor: "#FFF"
});
var tab = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'REGISTRY',
window:win
});
var regItems = [
{title: "List Item One", font:{fontSize: 25, fontWeight: 'bold'}, color: "#45165C", leftImage:"images/regImg.gif", className: "tableRow", hasDetail: true},
{title: "List Item Two", font:{fontSize: 25, fontWeight: 'bold'}, color: "#45165C", leftImage:"images/regImg.gif", className: "tableRow", hasDetail: true},
{title: "List Item Three", font:{fontSize: 25, fontWeight: 'bold'}, color: "#45165C", leftImage:"images/regImg.gif", className: "tableRow", hasDetail: true}
]
var regItemList = Titanium.UI.createTableView({
data: regItems
});
regItemList.addEventListener('click', function(e){
var win2 = Titanium.UI.createWindow({
url: "newWin.js",
title: e.rowData.title,
backgroundColor: "#273691"
});
win2.open();
// tab.open(win2, {animated: true}); This is also not working
});
win.add(regItemList);
// open tab group
tabGroup.open();
新的Win.js
var newWinCreate = Titanium.UI.currentWindow;
var labelName = Titanium.UI.createLabel({
title: "First Name",
font: {fontSize: 18},
top: 10,
left: 20,
color: "#fff",
textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER
});
newWinCreate .add(labelName);