ligi ligi - 5 months ago 27
Android Question

show icon in actionbar/toolbar with AppCompat-v7 21

I tried these - but still do not see the icon like before:

getSupportActionBar().setLogo(R.drawable.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
getSupportActionBar().setIcon(R.drawable.ic_launcher);


It seems to work when I use custom toolbar - but that would force me to touch all layouts - is there a better way to do so?

Answer

getSupportActionBar().setDisplayShowHomeEnabled(true);

along with

getSupportActionBar().setIcon(R.drawable.ic_launcher);

Comments