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?
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();
-
How below? Can you explain more?
-
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).
-
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 ). -
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.