Remove Icon but have HomeAsUp in ActionBar

I what my actionbar to have a title and homeAsUp but not the logo or icon.

like this:

Remove Icon but have HomeAsUp in ActionBar

I tried this:

actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle("My Profile");
actionBar.setDisplayUseLogoEnabled(false);

But it gives the application icon between the title and back arrow

Thank You

Android Default HomeAsUp on Custom ActionBar

I have a custom android action bar with a custom layout view and style. I need to show the ‘Home As Up’ Button for my navigation drawer. The problem is that the button is not showing up in my custom l

Animating ActionBar’s icon

I have an ActionBar icon (the main one on the left, not an action item) that I would like to animate. I am setting my ActionBar’s icon in my Activity like this: getSupportActionBar().setIcon(icon) whe

Remove ActionBar icon API < 11

I’m developing an application that should be compatible with APIs from 8 above. For versions of API>=11 I display some text in the ActionBar title, and for API<11 the text is shown in the TitleB

Actionbar notification count icon like Google have

Is there a android-standart icon or method to show action-bar notification icon with count like on Google examples? If no, than what is the best way to make it? I’m new to android, please help.

How do I remove the space of the actionbar icon?

I removed the icon using getActionBar().setDisplayShowHomeEnabled(false); I’m using a imageview with should fill the whole actionbar. I want to do it this way because I want the image as titlebar incl

Remove icon from searchview in ActionBar

I am using action bar support v7 library. When I expand search view I get look like this. I dont want this search icon on left. Instead I want to place it in hint like image below. I want to do this

Flashing Actionbar Icon

I have an ActionBar icon which is a button to a chat message screen. I have two copies of the icon. One standard grey, and one yellow. When I display the yellow icon to indicate there is a message wai

Icon or image in actionbar

i need to make icon(imageview) inside actionbar that have shown half of image inside actionbar and other half show in screen(layout) like below image: one idea is a image that have a transparent unde

ShareActionProvider icon in actionbar

I have implemented the share icon in the actionbar. After you press on it, and then pick which source you want to share it to, the icon widens and shows the last source you shared with. I don’t want

Custom overflow icon in Contextual ActionBar only

I have a dark ActionBar with a light Contextual ActionBar for ActionModes. I’ve seen this question about changing the overflow icon in the ActionBar, and it works, but I need a way to change it only f

Answers

Try to set this thing

actionBar.setLogo(null);
actionBar = getSupportActionBar();    
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle("My Profile");
actionBar.setDisplayUseLogoEnabled(false);

To hide the icon as well try using setIcon(null)

actionBar = getSupportActionBar();
actionBar.setTitle("My Profile");
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setIcon(null);
actionBar.setHomeButtonEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);

Open your styles.xml file and add below codes in your Actionbar style

<item name="android:displayOptions">showHome|homeAsUp|showTitle</item>
<item name="displayOptions">showHome|homeAsUp|showTitle</item>
<item name="android:icon">@android:color/transparent</item> <--this do the magic!

p/s: I’m using Actionbar Sherlock and this works just fine

If you do not want the icon in particular activity.

getActionBar().setIcon(
   new ColorDrawable(getResources().getColor(android.R.color.transparent)));

To hide action bar icon following methods works for me

method-1:getActionBar().setIcon(android.R.color.transparent);
method-2:getActionBar().setIcon(null);
getActionBar().setIcon(
new ColorDrawable(getResources().getColor(android.R.color.transparent)));

it works for me.

getActionBar().setHomeButtonEnabled(true);//used to navigate to home
 getActionBar().setDisplayHomeAsUpEnabled(false);//used to hide the left caret symbol