Titanium,actionBar图标不起作用

时间:2014-02-02 20:15:52

标签: android android-actionbar titanium titanium-mobile titanium-alloy

if(Alloy.Globals.isAndroid){//if platform is android
  $.tabGroup.addEventListener("open", function(e) {

    var activity = $.tabGroup.getActivity();// I use tabgroup. get activity

    var actionBar = activity.actionBar;
    actionBar.icon =Ti.App.Android.R.drawable.logo;//this code not working

    activity.onCreateOptionsMenu = function(e) {
        var menuItem = e.menu.add({
            title : "Refresh",
            showAsAction : Ti.Android.SHOW_AS_ACTION_ALWAYS,
            icon:  Titanium.App.Android.R.drawable.ic_action_refresh //this code working right
        });
        menuItem.addEventListener("click", refreshMain);
    };
    activity.invalidateOptionsMenu();


  });
}

我想设置actionBar图标。菜单项图标正常,但actionBar图标无效。我在哪里做错了?

0 个答案:

没有答案