Custom image instead of logo in ActionBar/ActionBarSherlock

Carlos picture Carlos · Oct 4, 2013 · Viewed 14.2k times · Source

How can I change the default logo icon of an ActionBar to be a custom image? Similar as how it works on Whatsapp? Whatsapp custom image as logo

Answer

Pankaj Kumar picture Pankaj Kumar · Oct 4, 2013

The ActionBar uses the android:logo attribute of your manifest, if one is provided. That lets you use separate drawable resources for the icon (Launcher) and the logo (ActionBar, among other things).


So you should add this tag into manifest like ..

<application
    android:logo="@drawable/custom_image"

Update :

You can use ActionBar.setLogo() for runtime. Two versions are there setLogo(int resId) and setLogo(Drawable logo).

Read Define custom Logo for ActionBar (different than Logo) in XML? which will help you to define some styles also.