Guest User

Untitled

a guest
Oct 16th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. // this sets the background color of the master UIView (when there are no windows/tab groups on it)
  2. Titanium.UI.setBackgroundColor('#000');
  3.  
  4. // create tab group
  5. var tabGroup = Titanium.UI.createTabGroup();
  6.  
  7. // // create base UI tab and root window //
  8.  
  9. var win1 = Titanium.UI.createWindow({
  10. title:'AllowMe',
  11. backgroundColor:'#fff'
  12. });
  13.  
  14. var tab1 = Titanium.UI.createTab({
  15. icon:'ToDoIcon.png',
  16. title:'Things To Do',
  17. window:win1
  18. });
  19.  
  20. var defaultColor = "#677230";
  21.  
  22. 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 } ];
  23.  
  24. var headerLabel = Titanium.UI.createView({
  25. backgroundColor:"white",
  26. color:"white",
  27. font:{ fontSize: 16, fontWeight:"bold" },
  28. text:"Things To Do",
  29. textAlign:"center",
  30. height:35,
  31. width:320
  32. });
  33.  
  34. var table = Titanium.UI.createTableView({
  35. data:data,
  36. headerView:headerLabel,
  37. top:10,
  38. width:320,
  39. });
  40.  
  41. // Add an event listener to respond to clicks in the TableView
  42. table.addEventListener('click', function(e) {
  43. // Report which item was clicked
  44. Titanium.UI.createAlertDialog({ title:'Alert', message:('Click at index: '+e.index) }).show();
  45. });
  46.  
  47. win1.add(table);
  48.  
  49. // // create controls tab and root window //
  50. var win2 = Titanium.UI.createWindow({
  51. title:'Rewards',
  52. backgroundColor:'#fff'
  53. });
  54.  
  55. var tab2 = Titanium.UI.createTab({
  56. icon:'RewardIcon.png',
  57. title:'Rewards',
  58. window:win2
  59. });
  60.  
  61. var label2 = Titanium.UI.createLabel({
  62. color:'#999',
  63. text:'Get Rewards',
  64. font:{fontSize:20,fontFamily:'American Typewriter'},
  65. textAlign:'center',
  66. width:'auto'
  67. });
  68.  
  69. win2.add(label2);
  70.  
  71. // add tabs //
  72. tabGroup.addTab(tab1);
  73. tabGroup.addTab(tab2);
  74.  
  75. // open tab group
  76. tabGroup.open();
Add Comment
Please, Sign In to add comment