Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Combination of webview and tabgroup

Hi,

I'm using the Kitchensink sample and I'm wondering if we can show a webview below the current tabgroup.

The tableview does this automatically.

Is this possible?

— asked May 4th 2010 by Hans Blaauw
  • tabgroup
  • webview
0 Comments

5 Answers

  • I was working with something similar, and thought I would just add what I did here to get the result I wanted. Basically I wanted a webview to show with the tab group still being open so that users can switch between tabs without having a backbutton etc. The code is simple, just the basic tab group code with the webview added directly in.

    // create tab group
    var tabGroup = Titanium.UI.createTabGroup();
    var win1 = Titanium.UI.createWindow({
        title:'Tab 1',
        backgroundColor:'#fff'
    });
    var tab1 = Titanium.UI.createTab({
        icon:'tab1icon.png',
        title:'Tab 1',
        window:win1
    });
    var win2 = Ti.UI.createWindow();
    var webview = Ti.UI.createWebView({
        title: 'Virtual tour',
        url: 'build/virtualtour.html'
        });
    win2.add(webview);
    win2.open();
    
    var tab2 = Titanium.UI.createTab({
        icon:'tab2icon.png',
        title:'Virtual Tour',
        window:win2   
    });
    // add tabs to the group
    tabGroup.addTab(tab1);
    tabGroup.addTab(tab2);
    // open tab group
    tabGroup.open();
    
    — answered March 30th 2012 by Thomas Myhre
    permalink
    0 Comments
  • How below? Can you explain more?

    — answered May 4th 2010 by Dan Tamas
    permalink
    0 Comments
  • Sorry, what I mean is that the tabgroup should always be visible even when opening a webview. With a tableview this works (my tabgroup is there) but not with a webview.

    So on top of page tabgroup and below that webview (filling up rest of page minus hight of tabgroup).

    — answered May 4th 2010 by Hans Blaauw
    permalink
    0 Comments
  • You will need to use a second window and inside this put the webview.
    The second window will be connected to the second tab ( or another if you have more ).

    — answered May 4th 2010 by Dan Tamas
    permalink
    0 Comments
  • That does not work, I already have that. I have a main script, home.js, that contains the tabgroup. From that I call a webview.js script that has the webview. It seems I have to paste the tabgroup code again in the webview script to let it work.

    — answered May 4th 2010 by Hans Blaauw
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.