在Titanium中为Android创建选项卡式应用程序

时间:2013-04-27 23:56:40

标签: titanium

我从基本的标签模型开始,使用KitchenSink开始改变,“定制”它以满足我的需求。我创建了3个tableviews,每个tableviews都打开了自己的垂直布局和tableviewrows。出于某种原因,我还没有看过。我无法在第一个标签上附加任何内容。帮助将不胜感激。

我还包含了JS文件的一部分

app.js

(function() {
//determine platform and form factor and render approproate components
var osname = Ti.Platform.osname,
    version = Ti.Platform.version,
    height = Ti.Platform.displayCaps.platformHeight,
    width = Ti.Platform.displayCaps.platformWidth;

//considering tablet to have one dimension over 900px - this is imperfect, so you   should feel free to decide
//yourself what you consider a tablet form factor for android
var isTablet = osname === 'ipad' || (osname === 'android' && (width > 899 ||    height > 899));

var Window;
if (isTablet) {
    Window = require('ui/tablet/ApplicationWindow');
}
else {
    Window = require('ui/handheld/ApplicationWindow');
}

var ApplicationTabGroup = require('ui/common/ApplicationTabGroup');
new ApplicationTabGroup(Window).open();

})();

applicationTabGroup。

function ApplicationTabGroup(Window) {
//create module instance
var self = Ti.UI.createTabGroup();

//create app tabs
var win1 = new Window(('Core Measures')),
    win2 = new Window(('Patient'));
    win3 = new Window(('Provider'));

var tab1 = Ti.UI.createTab({
    title: ('Core Measures'),
    window: win1
});
win1.containingTab = tab1;

var tab2 = Ti.UI.createTab({
    title: ('Patient'),
    window: win2
});
win2.containingTab = tab2;

var tab3 = Ti.UI.createTab({
    title: ('Provider'),
    window: win3
});
win3.containingTab = tab3;

self.addTab(tab1);
self.addTab(tab2);
self.addTab(tab3);

return self;

};

module.exports = ApplicationTabGroup;

的TableView

function CoreMeasures(title) {
var self = Ti.UI.createWindow({
    title:.title,
    backgroundColor:'white'
});
//create table view data object
var data = [
   {title: 'Pneumonia', hasChild : true, test: 'ui/common/pneumonia'},
   {title: 'CHF', hasChild: true, test:ui/common/CHF'},
   {title: 'Myocardial Infarction', hasChild: true, test: 'ui/common/Myocardial Infarction'};
]




// create table view
for (var i = 0; i < data.length; i++ ) { 
var d = data[i];
if(d.touchEnabled !==false) {
    d.color = '#000'
    data:data
});

// create table view event listener
tableview.addEventListener('click', function(e)
{
   if (e.rowData.test)
    {
        var ExampleWindow = require(e.rowData.test),
            win = new ExampleWindow({title:e.rowData.title,containingTab:self.containingTab,tabGroup:self.tabGroup});
        if (Ti.Platform.name == "android") {

        } else {
            win.backgroundColor = "#fff"

1 个答案:

答案 0 :(得分:0)

有几件事。我没有看到你调用CoreMeasures功能的任何地方。您也可能遇到以下代码的问题:

function CoreMeasures(title) {
var self = Ti.UI.createWindow({
    title:.title,
    backgroundColor:'white'
});

我在你的标题前注意到了一个点。