Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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:'AllowMe',
- backgroundColor:'#fff'
- });
- var tab1 = Titanium.UI.createTab({
- icon:'ToDoIcon.png',
- title:'Things To Do',
- window:win1
- });
- var defaultColor = "#677230";
- var data = [ { title:"Make Bed", color:defaultColor }, { title:"Brush Teeth", color:defaultColor }, { title:"Feed Dog", color:defaultColor }, { title:"Walk Dog", color:defaultColor }, { title:"Clear Table", color:defaultColor }, { title:"Do Homework", color:defaultColor }, { title:"Put Away Toys", color:defaultColor }, { title:"Fold Laundry", color:defaultColor }, { title:"Practice Flute", color:defaultColor }, { title:"Be Polite", color:defaultColor } ];
- var headerLabel = Titanium.UI.createView({
- backgroundColor:"white",
- color:"white",
- font:{ fontSize: 16, fontWeight:"bold" },
- text:"Things To Do",
- textAlign:"center",
- height:35,
- width:320
- });
- var table = Titanium.UI.createTableView({
- data:data,
- headerView:headerLabel,
- top:10,
- width:320,
- });
- // Add an event listener to respond to clicks in the TableView
- table.addEventListener('click', function(e) {
- // Report which item was clicked
- Titanium.UI.createAlertDialog({ title:'Alert', message:('Click at index: '+e.index) }).show();
- });
- win1.add(table);
- // // create controls tab and root window //
- var win2 = Titanium.UI.createWindow({
- title:'Rewards',
- backgroundColor:'#fff'
- });
- var tab2 = Titanium.UI.createTab({
- icon:'RewardIcon.png',
- title:'Rewards',
- window:win2
- });
- var label2 = Titanium.UI.createLabel({
- color:'#999',
- text:'Get Rewards',
- font:{fontSize:20,fontFamily:'American Typewriter'},
- textAlign:'center',
- width:'auto'
- });
- win2.add(label2);
- // add tabs //
- tabGroup.addTab(tab1);
- tabGroup.addTab(tab2);
- // open tab group
- tabGroup.open();
Add Comment
Please, Sign In to add comment