Custom Home Icon in Action Bar Sherlock

sealskej picture sealskej · Oct 31, 2011 · Viewed 18.5k times · Source

I am trying to set custom icon for home icon using ActionBarSherlock library. I have tried to set custom layout using abHomeLayout attribute in my custom theme. But it didn't work for me. Only way, how to set it, is to set abIcon attribute for my custom drawble, but I cannot set some horizontal padding for this drawable. Is there any example for this or where could be a problem with abHomeLayout attribute?

Answer

Matthew picture Matthew · Jun 3, 2012

This works for my situation, it replaces the default ic_launcher icon in the action bar with my custom one.

In your onCreate do this:

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

Or in the manifest you can set the logo:

<activity>
    android:logo="@drawable/my_custom_logo"
    ...
</activity>