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图标无效。我在哪里做错了?