Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11650] Android: Action bar is not showing icon along with text for the menu item in spite of space availability.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2012-12-06T21:49:04.000+0000
Affected Version/sRelease 3.0.0
Fix Version/s2012 Sprint 25, 2012 Sprint 25 Core
ComponentsAndroid
Labelsqe-and214
ReporterShyam Bhadauria
AssigneeIngo Muschenetz
Created2012-11-02T09:30:10.000+0000
Updated2013-11-07T18:26:51.000+0000

Description

Not a regression. This is a new feature. Not visible with 2.1.4. Steps to reproduce: 1. Use the code below in app.js
var win = Ti.UI.createWindow({fullscreen: false, backgroundColor: 'red'});
 
win.activity.onCreateOptionsMenu = function(e) {
  var item = e.menu.add({title: 'expand',icon:'images/flower.jpg'});
  item.showAsAction = Ti.Android.SHOW_AS_ACTION_WITH_TEXT;
 
  var collapseActionButton = Ti.UI.createButton({
    title: 'Collapse'
  });
  collapseActionButton.addEventListener('click', function() {
    item.collapseActionView();
  });
  item.actionView = collapseActionButton;
 
  item.on('expand', function() {
    alert('Expanded menu item!');
  });
  item.on('collapse', function() {
    alert('Collapsed menu item!');
  });
  item.on('click', function() {
    alert('clicked!');
  });
}
 
win.open();
2. Add the below code in tiapp.xml
<android xmlns:android="http://schemas.android.com/apk/res/android">
    <tool-api-level>11</tool-api-level>
    <manifest>
        <uses-sdk android:targetSdkVersion="11"/>
        <!-- other manifest entries -->
    </manifest>
</android>
3. Run the app and click the action bar Expected result 3. The action bar should display the menu item 'expand' along with an icon image. Actual result: 3. The action bar only displays the title and not the icon. Even on using 'item.showAsAction = Ti.Android.SHOW_AS_ACTION_IF_ROOM;' alone as well as along with 'Ti.Android.SHOW_AS_ACTION_WITH_TEXT;' , it do not shows icon even when enough space is available.

Comments

  1. Allen Yeung 2012-12-06

    As mentioned in the android action bar docs, the action bar's overflow menu shows text only by design. http://developer.android.com/guide/topics/ui/actionbar.html Marking ticket as invalid.
  2. Dhirendra Jha 2013-04-11

    Verified With - SDK - 3.1.0.v20130409124549 Appcelerator Studio - 3.1.0.201304091724 OS - Montain Lion (v10.8) Device - Samsung Galaxy Tab (v3.2) Closing this issue as per the last comment.

JSON Source