Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18148] Android: showAsAction can't take multiple parameters for MenuItem of Action Bar

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsMenuItem, actionbar, showAsAction
ReporterPaul Hamilton
AssigneeUnknown
Created2014-12-05T13:16:49.000+0000
Updated2018-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
			});
		};

Comments

No comments

JSON Source