Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-11650

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Invalid
    • Affects Version/s: Release 3.0.0
    • Component/s: Android
    • Labels:
    • Environment:

      Environment used for verification -
      Titanium SDK:3.0.0.v20121025171611
      Titanium  Studio:3.0.0.201210220122
      Device : Tablet Nexus 7 Android 4.1
      Xcode : 4.5
      Machine OS : MAC 10.8

      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.

        Attachments

          Activity

            People

            • Assignee:
              ingo Ingo Muschenetz
              Reporter:
              sbhadauria Shyam Bhadauria
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-14856
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration