Are icons supported for Android OptionMenu.MenuItem?
Note: reposting to correct title
Hi all,
I am having trouble setting an icon on an Android option menu, using the example code at the bottom of (https://developer.appcelerator.com/apidoc/mobile/1.3/Titanium.UI.Android.OptionMenu-module). Everything else works but the icon does not show.
I have even tried putting the image file in the same directory as the js file, but still with no success.
For example, icon : 'item1.png'
Note that I only have access to an emulator at this time.
I hope someone can kindly offer some suggestions.
Thanks
Hal
3 Answers
-
Accepted Answer
The path should be window relative. You can always reference it with an absolute path. (e.g /images/item1.png'). If you turn on your Trace level logging it may provide helpful information on the error.
-
Hi Don
Thank you for your reply.
If I use a path like '/images/item1.png', the title stops working.
There is also nowhere in the kitchensink that uses an icon for OptionMenu.
Have you had this working before?
Thank you kindly
Hal -
Hi all,
I am using icons in my Android applications and they work.
What I did is copy the icons' images in the Resources folder, then I use the following code:
var btn_add = Titanium.UI.Android.OptionMenu.createMenuItem({ title: 'Add New Task', icon: 'add.png' });
The code above is saved in a file but is not in the Root of the Resources folder, so if your .js file is in a sub-folder the code above should still work.