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

Android: Action bar logo changes when action item is expanded

    Details

      Description

      If the user specifies a custom applogo and creates an expandable action item, the logo changes when the item is expanded.

      Given an android manifest like this:

          <android xmlns:android="http://schemas.android.com/apk/res/android">
              <tool-api-level>14</tool-api-level>
              <manifest android:installLocation="auto">
                  <uses-sdk targetSdkVersion="14"/>
                  <application android:logo="@drawable/applogo" android:theme="@android:style/Theme.Holo">
                  </application>                
              </manifest>
          </android>
      

      The applogo image must exist in platforms/android/res/drawable/applogo.png and/or the appropriate density-specific drawables- folders. The icon must be different from the default titanium app icon. An unmistakably ugly one is attached for your testing pleasure.

      Run the sample code below:

      var win = Ti.UI.createWindow({fullscreen: false, backgroundColor: 'red'});
       
      win.activity.onCreateOptionsMenu = function(e) {
        var item = e.menu.add({title: 'Expand'});
        item.showAsAction = Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW;
       
        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();
      

      Note that when the action item is expanded, the custom applogo disappears, replaced by the standard app icon (the Up affordance is also displayed, which is correct).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pwang Ping Wang
                Reporter:
                aevans Arthur Evans
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration