[TIMOB-18148] Android: showAsAction can't take multiple parameters for MenuItem of Action Bar
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | MenuItem, actionbar, showAsAction |
Reporter | Paul Hamilton |
Assignee | Unknown |
Created | 2014-12-05T13:16:49.000+0000 |
Updated | 2018-02-28T19:55:43.000+0000 |
Description
Per Android action bar docs http://developer.android.com/guide/topics/ui/actionbar.html
If your menu item supplies both a title and an icon—with the title and icon attributes—then the action item shows only the icon by default. If you want to display the text title, add "withText" to the showAsAction attribute. For example:
it appears that you can't "or" them together in titanium. It always just does the "ifRoom" argument
var actionBar = $.win.activity.actionBar;
if (actionBar) {
//actionBar.title = "";
//actionBar.icon = "";
//actionBar.logo = "";
}
$.win.activity.onCreateOptionsMenu = function(e) {
var menu = e.menu;
var logoutItem = menu.add({
title: "logout",
icon: "/images/logout.png",
showAsAction: Ti.Android.SHOW_AS_ACTION_IF_ROOM | Ti.Android.SHOW_AS_ACTION_WITH_TEXT
});
};
No comments