[Android] Nested Windows in TabGroup don't work?
Hi,
I am trying to give a title bar to the Window that is shown by in a tab on Android.
While a window in a tab has a title bar on iPhone, the bar is not shown on Android.
But if you have an App that keeps the tabs on top (iPhone bottom) while displaying valuable information in the title (think NavigationController) this is neccessary.
The workaround I tried was to add an empty lightweight window to the tab, and then add a heavyweight window to that "container".
The code I used looks as follows:
var tabGroup = Titanium.UI.createTabGroup();
var win1 = Titanium.UI.createWindow({
title:'Window 1',
backgroundColor:'#f0f'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
// This should be a "Lightweight Window" on Android,
// so it should be usable as a container(?)
var win2 = Titanium.UI.createWindow();
// The fullScreen attribute should make sure
// that this is a HeavyWeight window on Android
var win3 = Titanium.UI.createWindow({
title:'Window 3',
backgroundColor:'#ff0',
fullscreen: false
});
var label2 = Titanium.UI.createLabel({
color:'#999',
text:'I am Label 2',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
// Add the container window
win2.add(win3);
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_ui.png',
title:'Tab 2',
window:win2
});
// add tabs
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
However, this throws the classic error on Android when touching the second tab. (Sorry! The application has stopped unexpectedly).
Somebody out there have a solution to the "Title Bar in Tabbed Window" Problem?
3 Answers
-
Accepted Answer
I think the problem is android doesn't allow windows inside windows.
I had the same problem and found a reference somewhere that said to use views instead of windows in android and got it working. Not very obvious from the documentation though. -
-
Did any one find the answer to this?
I want exactly the same as the following: http://android-apps.com/wp-content/uploads/2010/08/GetGlue_Android_Home.png
Any help is appreciated.
Cheers
Chris