ricardoalcocer / actionbarextras

Titanium Android Native Module that exposes ActionBar features not exposed by the Titanium SDK
MIT License
148 stars 60 forks source link

Icons do not appear #113

Open necrocyber opened 8 years ago

necrocyber commented 8 years ago

The icons in the action bar, do not appear in certain occasions, what is the problem to this?

actividad.onCreateOptionsMenu = function(e) {
  e.menu.clear();

  var settingsItem = e.menu.add({
    itemId: 101, // don't forget to set an id here
    title: "Settings",
    showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS
  });

  settingsItem.addEventListener('click', function(){
    alert('Settings clicked');
  });

  abx.setMenuItemIcon({
    menu: e.menu,
    menuItem: settingsItem,
    fontFamily: fa.fontfamily,
    icon: fa.icon("fa-gear"),
    color: "#fff",
    size: 30
  });
};
manumaticx commented 7 years ago

I can not see an error in the above code. This seems to be our example code. So it should work.

Are you sure, onCreateOptionsMenu gets called?

chmiiller commented 7 years ago

I'm having the same. The onCreateOptionsMenu is not being called, don't know why =/

manumaticx commented 7 years ago

Referring to the example project, calling win.activity.invalidateOptionsMenu(); triggers the system to call onCreateOptionsMenu again.