Titanium JIRA Archive
Alloy (ALOY)

[ALOY-439] ActionItems created in markup don't appear in action bar.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusResolved
ResolutionCannot Reproduce
Resolution Date2014-02-07T15:58:40.000+0000
Affected Version/sAlloy 0.3.3
Fix Version/s2014 Sprint 03
ComponentsXML
Labelsn/a
ReporterArthur Evans
AssigneeTim Poulsen
Created2012-12-20T03:10:55.000+0000
Updated2014-02-11T16:09:28.000+0000

Description

I'm trying to create action items using code like this: index.xml:
<Alloy>
	<Window class="container" onOpen="doWindowOpen" navBarHidden="false" exitOnClose="true">
		<Menu id="menu" platform="android">
			<MenuItem id="item1" title="One" onClick="doMenuClick" />
			<MenuItem id="item2" title="Two" onClick="doMenuClick" />
		</Menu>
		<Label id="label" onClick="doClick">Hello, World</Label>
	</Window>
</Alloy>
index.tss:
".container": {
},
"MenuItem": {
	showAsAction: Ti.Android.SHOW_AS_ACTION_ALWAYS
},
"#item1": {
	title: "One"
},
"#item2": {
	title: "Two",
	icon: "images/action_refresh.png"
},

"Label": {
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
	color: "#000"
} 
However, even though the menu items seem to be being created with showAsAction set to Ti.Android.SHOW_AS_ACTION_ALWAYS, they don't show up in the UI. If I add menu items in the open callback by specifying an onCreateOptionsMenu method and then calling invalidateOptionsMenu, the action items appear correctly. Conclusion: something is jacked with the menu items created from markup. (Deep, huh?)

Attachments

FileDateSize
app.zip2014-02-07T15:56:41.000+00003262411
Screen Shot 2014-02-07 at 10.56.46 AM.png2014-02-07T15:57:39.000+000026617

Comments

  1. Tim Poulsen 2014-02-07

    attached file
  2. Tim Poulsen 2014-02-07

    screenshot
  3. Tim Poulsen 2014-02-07

    I cannot reproduce with Alloy 1.3.0, SDK 3.2.0.GA. Tested with the attached app. See the screenshot attached for my results. Items appear in ActionBar as expected, event handlers fire when clicked.

JSON Source