Android: View only shows up if the app is already running

You must Login before you can answer or comment on any questions.

The first time I open my app, I have a view in a view in a Table row in a table which doesn't show up. If I press the home button, and then open it again, it shows up. If I clear it from my stack, then open it up again, it doesn't show up. Anyone know why?

var journalView = Titanium.UI.createView({
    backgroundImage: 'NONE',
    height: '100%',
    width: Titanium.UI.FILL
});
 
var rateButton = Titanium.UI.createView({
    backgroundColor: '#27a0d7',
    height: '50%',
    width: '80%',
    borderRadius: 20,
    zIndex: 100
});
 
var rateLabel = Titanium.UI.createLabel({
    color: 'black',
    font: {fontSize: '40dp', fontFamily: self.fontName},
    text: 'RATE =>',
    verticalAlign: Titanium.UI.TEXT_VERTICAL_ALIGNMENT_CENTER,
    //top: 10
});
 
rateButton.add(rateLabel); 
journalView.add(rateButton);
journalRow.add(journalView);
 
rows.push(journalRow);
var homeTable = Titanium.UI.createTableView({
    allowsSelection: false,
    data: rows
});
homeWin.add(homeTable);

— asked 11 months ago by Colin DeClue
2 Comments
  • Seems like you have a pretty concise example. How about if you provide a little bit more code and give us a simple app.js that replicates the problem?

    — commented 11 months ago by Jason Priebe

  • Here's an app.js that replicates the problem. Note that if I get rid of the tab group stuff, and just keep win1 as the only window, it works as expected:

    // this sets the background color of the master UIView (when there are no windows/tab groups on it)
    Titanium.UI.setBackgroundColor('#000');
     
    // create tab group
    var tabGroup = Titanium.UI.createTabGroup();
     
     
    //
    // create base UI tab and root window
    //
    var win1 = Titanium.UI.createWindow({  
        title:'Tab 1',
        backgroundColor:'#fff'
    });
    var tab1 = Titanium.UI.createTab({  
        icon:'KS_nav_views.png',
        title:'Tab 1',
        window:win1
    });
     
    var rows = [];
    var journalRow = Titanium.UI.createTableViewRow({
        backgroundColor: 'white',
        height: '100dp'
    });
    rows.push(journalRow);
     
    var journalView = Titanium.UI.createView({
        backgroundImage: 'NONE',
        backgroundColor: '#27a0d7',
        height: '100%',
        width: Titanium.UI.FILL,
        zIndex: 1
    });
    journalRow.add(journalView);
     
    var homeTable = Titanium.UI.createTableView({
        allowsSelection: false,
        data: rows
    });
    win1.add(homeTable);
     
    //
    // create controls tab and root window
    //
    var win2 = Titanium.UI.createWindow({  
        title:'Tab 2',
        backgroundColor:'#fff'
    });
    var tab2 = Titanium.UI.createTab({  
        icon:'KS_nav_ui.png',
        title:'Tab 2',
        window:win2
    });
     
    var label2 = Titanium.UI.createLabel({
        color:'#999',
        text:'I am Window 2',
        font:{fontSize:20,fontFamily:'Helvetica Neue'},
        textAlign:'center',
        width:'auto'
    });
     
    win2.add(label2);
     
     
     
    //
    //  add tabs
    //
    tabGroup.addTab(tab1);  
    tabGroup.addTab(tab2);  
     
     
    // open tab group
    tabGroup.open();

    — commented 11 months ago by Colin DeClue

Your Answer

Think you can help? Login to answer this question!