Closed myselfdeveloping closed 9 years ago
Yes, it's all in the docs / example
activity.onCreateOptionsMenu = function(e){
activity.actionBar.displayHomeAsUp = true;
abx.setHomeAsUpIcon("/images/myArrow.png");
};
Doesn't work for me! This is my code:
$.index.addEventListener('open',function(e){
var activity = $.index.getActivity();
if (activity) {
var abx = require('com.alcoapps.actionbarextras');
abx.title = "Valuta Amici";
abx.titleColor = "White";
abx.backgroundColor = "#017695";
activity.onCreateOptionsMenu = function(e){
activity.actionBar.displayHomeAsUp = true;
abx.setHomeAsUpIcon("/images/icone/cerca.png");
};
}
});
The error that Console returns is: [ERROR] : ActionbarextrasModule: (main) [785,3842] Couldn't resolve /images/icone/cerca.png but the path is rigth. Where I'm wrong?
Try calling activity.invalidateOptionsMenu();
after defining onCreateOptionsMenu
:
$.index.addEventListener('open',function(e){
var activity = $.index.getActivity();
if (activity) {
var abx = require('com.alcoapps.actionbarextras');
abx.title = "Valuta Amici";
abx.titleColor = "White";
abx.backgroundColor = "#017695";
activity.onCreateOptionsMenu = function(e){
activity.actionBar.displayHomeAsUp = true;
abx.setHomeAsUpIcon("/images/icone/cerca.png");
};
activity.invalidateOptionsMenu();
}
});
Ooops, this was wrong! :see_no_evil:
If it says "Couldn't resolve /images/icone/cerca.png"
then you have to provide density-independent graphics (mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi), see #68
For reference, check out the example
Thanks a lot!
You're welcome :)
I'm trying to change the arrow icon in action bar with another icon but I don't found a solution! Someone can help me?