Created
April 20, 2012 15:12
-
-
Save pec1985/2429502 to your computer and use it in GitHub Desktop.
Android Menu Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ | |
exitOnClose: true, | |
backgroundColor: '#ccc', | |
fullscreen: false | |
}); | |
win.open(); | |
var activity = win.activity; | |
activity.onCreateOptionsMenu = function(e){ | |
var menu = e.menu; | |
var btn1 = menu.add({title: 'Hello btn 1'}); | |
btn1.setIcon(Ti.Android.R.drawable.ic_menu_camera); | |
var btn2 = menu.add({title: 'Hola btn2'}); | |
btn2.setIcon(Ti.Android.R.drawable.ic_search_category_default); | |
btn1.addEventListener('click', function(){ | |
alert('btn1'); | |
}); | |
btn2.addEventListener('click', function(){ | |
alert('btn2'); | |
}); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment