0
嗨我想建立一個簡單的移動應用程序使用鈦工作室和麪臨的問題,從Android模擬器中的表視圖列表項打開新窗口。這是我在我的js文件中使用的代碼。新窗口是不是在Android模擬器使用鈦打開
app.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();
newWin.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);
是regItemList單擊事件工作?你有沒有在日誌中看到任何錯誤或警告? –
是的,它正在工作,例如,如果我把警報();它顯示了警報窗口。 – Raghav