Open deckameron opened 9 years ago
Hi @nuno,
How do you use the ActionBar with this SDK? I watched your video and I noticed you managed to used Drawer Menu and ActionBar Menu, how do you do it?
I tried to use the ActionBar like I normally do on the older SDK's, but it didn't work. Here is my code:
//self = window self.addEventListener('focus', function(){ var activity = this.getActivity(); if(activity){ activity.onCreateOptionsMenu = function(e){ var menu = e.menu;
var menuFavoritar = menu.add({ title : 'Favoritar', showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS }); menuFavoritar.addEventListener("click", function(e){ }); var menuCompartilhar = menu.add({ title : 'Compartilhar', showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS }); menuCompartilhar.addEventListener("click", function(e){ }); //Escondidos var menuFipe = menu.add({ title : 'Tabela Fipe', showAsAction : Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW }); menuFipe.addEventListener("click", function(e){ }); var menuFichaTecnica = menu.add({ title: 'Ficha Técnica', showAsAction : Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW }); menuFichaTecnica.addEventListener("click", function(e){ }); var menuFavoritos = menu.add({ title: 'Favoritos', showAsAction : Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW }); menuFavoritos.addEventListener("click", function(e){ }); var anuncie = menu.add({ title: 'Anuncie aqui', showAsAction : Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW }); anuncie.addEventListener("click", function(e){ }); }; activity.invalidateOptionsMenu(); var actionBar = activity.getActionBar(); if (actionBar) { actionBar.setDisplayHomeAsUp(true); actionBar.setTitle('Material Design'); actionBar.show(); actionBar.setOnHomeIconItemSelected(function() { window.close(); }); } } });
@deckameron check this project https://github.com/nuno/Ti.DrawerLayout-Demo-Alloy-App
Thanks, @nuno! :+1:
Hi @nuno,
How do you use the ActionBar with this SDK? I watched your video and I noticed you managed to used Drawer Menu and ActionBar Menu, how do you do it?
I tried to use the ActionBar like I normally do on the older SDK's, but it didn't work. Here is my code:
//self = window self.addEventListener('focus', function(){ var activity = this.getActivity(); if(activity){ activity.onCreateOptionsMenu = function(e){ var menu = e.menu;