In addition to the answer of Gabriele Mariotti.
You can try replacing the android.R.id.home file with ActionViewfrom the mentioned library.
Find and replace it:
private void replaceHomeView(Activity activity){
View homeView;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
Resources resources = activity.getResources();
int id = resources.getIdentifier("android:id/home", null, null);
homeView = activity.getWindow().getDecorView().findViewById(id);
} else {
homeView = activity.getWindow().getDecorView().findViewById(R.id.home);
}
replace(homeView);
}
Remove and replace the home icon ImageView:
private replace(View home){
ViewGroup parent = (ViewGroup) view.getParent();
int homeIndex = parent.indexOfChild(view);
ActionView newHome = new ActionView(home.getContext));
newHome.setId(home.getId());
parent.removeView(home);
parent.addView(newHome, homeIndex);
}
Note: I have not tested this myself.
source
share