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

Android TabGroup's actionBar actionViews don't expand

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Cannot Reproduce
    • Affects Version/s: Release 3.1.3
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:

      Android 4.3
      SDK 3.1.3.GA

      Description

      Problem Description

      When adding a menuItem to the actionBar with an actionView and

      showAsAction : Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW | Ti.Android.SHOW_AS_ACTION_ALWAYS

      to a TabGroup, the item never expands to show the actionView. This is with a TabGroup, and nothing happens when i click the 'search' icon.

      Test Case

      var win = Ti.UI.createTabGroup({
          backgroundColor: 'blue',
          fullscreen: false
      });
      var tab = Ti.UI.createTab({title: "test"});
      var tabWin = Ti.UI.createWindow({title: "testWin"});
      tab.window = tabWin;
      win.add(tab);
       
      var search;
      var searchAsChild = false;
       
      if (Ti.Platform.name == 'android' && Ti.Platform.Android.API_LEVEL > 11) {
          // Use action bar search view
          search = Ti.UI.Android.createSearchView({
              hintText: "Table Search"
          });
       
      	win.addEventListener("open", function(e) {
          win.getActivity().onCreateOptionsMenu = function(e) {
              var menu = e.menu;
              var menuItem = menu.add({
                  title: 'Table Search',
                  actionView : search,
                  icon: (Ti.Android.R.drawable.ic_menu_search ? Ti.Android.R.drawable.ic_menu_search : "my_search.png"),
                  showAsAction: Ti.Android.SHOW_AS_ACTION_IF_ROOM | Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
              });
          };
      	});
      }
      else {
          // Use search bar
          search = Ti.UI.createSearchBar({
              hintText: "Table Search"
          });
          searchAsChild = true;
      }
       
      var data = [];
      data.push(Ti.UI.createTableViewRow({title:'Apple'}));
      data.push(Ti.UI.createTableViewRow({title:'Banana'}));
      data.push(Ti.UI.createTableViewRow({title:'Orange'}));
      data.push(Ti.UI.createTableViewRow({title:'Raspberry'}));
       
      var tableview = Titanium.UI.createTableView({
          data:data,
          search:search,
          searchAsChild:searchAsChild
      });
       
      win.add(tableview);
      win.open();

      Extra info

      However, when i try it with a Window instead of a TabGroup, it does work: (note: this is identical to previous case except for changing the tabgroup to a window)

      var win = Ti.UI.createWindow({
          backgroundColor: 'blue',
          fullscreen: false
      });
      //var tab = Ti.UI.createTab({title: "test"});
      //var tabWin = Ti.UI.createWindow({title: "testWin"});
      //tab.window = tabWin;
      //win.add(tab);
       
      var search;
      var searchAsChild = false;
       
      if (Ti.Platform.name == 'android' && Ti.Platform.Android.API_LEVEL > 11) {
          // Use action bar search view
          search = Ti.UI.Android.createSearchView({
              hintText: "Table Search"
          });
       
      	win.addEventListener("open", function(e) {
          win.getActivity().onCreateOptionsMenu = function(e) {
              var menu = e.menu;
              var menuItem = menu.add({
                  title: 'Table Search',
                  actionView : search,
                  icon: (Ti.Android.R.drawable.ic_menu_search ? Ti.Android.R.drawable.ic_menu_search : "my_search.png"),
                  showAsAction: Ti.Android.SHOW_AS_ACTION_IF_ROOM | Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
              });
          };
      	});
      }
      else {
          // Use search bar
          search = Ti.UI.createSearchBar({
              hintText: "Table Search"
          });
          searchAsChild = true;
      }
       
      var data = [];
      data.push(Ti.UI.createTableViewRow({title:'Apple'}));
      data.push(Ti.UI.createTableViewRow({title:'Banana'}));
      data.push(Ti.UI.createTableViewRow({title:'Orange'}));
      data.push(Ti.UI.createTableViewRow({title:'Raspberry'}));
       
      var tableview = Titanium.UI.createTableView({
          data:data,
          search:search,
          searchAsChild:searchAsChild
      });
       
      win.add(tableview);
      win.open();

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ybanev Yordan Banev
                Reporter:
                olmokramer Olmo Kramer
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code