{ "id": "146365", "key": "AC-1112", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2015-03-30T06:55:13.000+0000", "created": "2015-03-28T13:40:03.000+0000", "labels": [ "actionView", "actionview", "android", "titanium" ], "versions": [], "issuelinks": [], "assignee": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "updated": "2016-03-08T07:37:28.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I'm currently having a problem with actionView for a menu item on android: never shown into actionbar.\r\nHere is my code:\r\n\r\n{code:title=Controller.js|borderStyle=solid}\r\n//On window open\r\nif (this.getActivity()) {\r\n this.getActivity().invalidateOptionsMenu();\r\n this.getActivity().onCreateOptionsMenu = createAndroidOptionsMenu();\r\n \r\n var action_bar = this.getActivity().getActionBar();\r\n\r\n if (action_bar) {\r\n action_bar.setTitle('MyAppTitle');\r\n }\r\n }\r\n\r\nfunction createAndroidOptionsMenu(event) {\r\n return function(event) {\r\n var menu = event.menu;\r\n var search = Ti.UI.Android.createSearchView({ hintText: 'Search..' ,id: \"FlingerSearchBar\"});\r\n search.addEventListener(\"submit\", function(event){\r\n \tconsole.log(search.value);\r\n });\r\n \r\n var menu_search_item = menu.add({ \r\n title: \"Ricerca fling\", \r\n actionView: search,\r\n icon: Ti.Android.R.drawable.ic_menu_search,\r\n showAsAction: Ti.Android.SHOW_AS_ACTION_IF_ROOM | Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW,\r\n \r\n });\r\n \r\n var action_view = Ti.UI.createView({\r\n width: 20,\r\n height: 20,\r\n backgroundColor: \"white\"\r\n });\r\n \r\n var menu_notification_item = menu.add({\r\n title: \"Notifiche\",\r\n showAsAction: Titanium.Android.SHOW_AS_ACTION_ALWAYS,\r\n });\r\n \r\n //HERE'S THE PROBLEM!!! THE ACTIONVIEW WILL NEVER SHOWN\r\n menu_notification_item.setActionView(action_view); \r\n \r\n var menu_flingers_item = menu.add({\r\n title: \"Flingers\",\r\n icon: \"images/ic_action_friends.png\",\r\n showAsAction: Ti.Android.SHOW_AS_ACTION_IF_ROOM | Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW\r\n });\r\n \r\n menu_flingers_item.addEventListener(\"click\", $.DrawerWindow.toggleRightWindow);\r\n menu_notification_item.addEventListener(\"click\", function() {\r\n Ti.API.info(\"CLICK\");\r\n });\r\n };\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "Android MenuItem actionView doesn't work", "creator": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Developing on Mac OS X Yosemite\r\nTesting on HTC One M8 (Android 5.1)", "comment": { "comments": [ { "id": "347650", "author": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "body": "Mark it as closed, it was my fault. Sorry.", "updateAuthor": { "name": "Andrea.Vitale", "key": "andrea.vitale", "displayName": "Andrea Vitale", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-03-28T16:20:01.000+0000", "updated": "2015-03-28T16:20:01.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }