Skip to content

Instantly share code, notes, and snippets.

@alanleard
Created December 6, 2011 05:09
Show Gist options
  • Save alanleard/1436845 to your computer and use it in GitHub Desktop.
Save alanleard/1436845 to your computer and use it in GitHub Desktop.
Indicators on Tabgroup & TabbedBar
var win = Ti.UI.createWindow();
var tabGroup = Ti.UI.createTabGroup();
function indicator(count, top, left, color){
var label = Ti.UI.createLabel({
backgroundColor:color,
text:count,
borderColor:'#fff',
borderRadius:10,
borderWidth:2,
height:20,
width:20,
color:'#fff',
font:{fontWeight:'bold'},
textAlign:'center',
top:top,
left:left,
touchEnabled:false
});
return label;
}
var win1 = Titanium.UI.createWindow({
title:'1',
backgroundColor:'#fff'
});
var bb1 = Titanium.UI.createTabbedBar({
labels:['One', 'Two', 'Three'],
backgroundColor:'#336699',
style:Titanium.UI.iPhone.SystemButtonStyle.BAR,
height:49,
width:200,
top:50
});
bb1.add(indicator('2',-3,180, 'blue'));
win1.add(bb1);
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'1',
window:win1
});
tabGroup.addTab(tab1);
var win2 = Titanium.UI.createWindow({
title:'2',
backgroundColor:'#fff'
});
var tab2 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'2',
window:win2
});
tabGroup.addTab(tab2);
tabGroup.open();
tabGroup.add(indicator('2',405,300,'red'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment