Organizational Research By

Surprising Reserch Topic

remove icon logo from action bar on android


remove icon logo from action bar on android  using -'android,xml,android-layout,android-actionbar,titlebar'

I've been trying to find some way of removing the icon/logo from the action bar but the only thing I've found after an hour of searching SO, Android's documentation and Google is how to remove the title bar in whole. That is not what I want. Only want to remove the icon/logo from the title bar.

Any one know how to accomplish this? Preferably I'd like to do this in XML.
    

asked Oct 11, 2015 by gauravsinghal83
0 votes
4 views



Related Hot Questions

13 Answers

0 votes

If you've defined android:logo="..." in the tag of your AndroidManifest.xml, then you need to use this stuff to hide the icon:

pre-v11 theme

@android:color/transparent

v11 and up theme

@android:color/transparent

The use of these two styles has properly hidden the action bar icon on a 2.3 and a 4.4 device for me (this app uses AppCompat).

answered Oct 11, 2015 by kotmus2002
0 votes

Add the following code in your action bar styles:

showHome|homeAsUp|showTitle
showHome|homeAsUp|showTitle
@android:color/transparent 

PS: I'm using Actionbar Sherlock and this works just fine.

answered Oct 11, 2015 by rajeshujade
0 votes

If you do not want the icon in particular activity.

getActionBar().setIcon(
   new ColorDrawable(getResources().getColor(android.R.color.transparent)));    
answered Oct 11, 2015 by yogeshplv
0 votes

Calling

mActionBar.setDisplayHomeAsUpEnabled(true);

in addition to,

mActionBar.setDisplayShowHomeEnabled(false);

will hide the logo but display the Home As Up icon. :)

answered Oct 11, 2015 by mca.agarwal
0 votes
    //disable application icon from ActionBar
    getActionBar().setDisplayShowHomeEnabled(false);

    //disable application name from ActionBar
    getActionBar().setDisplayShowTitleEnabled(false);
answered Oct 11, 2015 by mca.agarwal
0 votes

you can also add below code in AndroidManifest.xml.

android:icon="@android:color/transparent"

It will work fine.

But I found that this gives a problem as the launcher icon also become transparent.

So I used:

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

and it worked fine.

But if you are having more than one activity and want to make the icon on an activity transparent then the previous approach will work.

answered Oct 11, 2015 by atulpariharmca
0 votes

Remove or show the title using:

getActionBar().setDisplayShowTitleEnabled(true);

Remove or show the logo using:

getActionBar().setDisplayUseLogoEnabled(false);

Remove all:

getActionBar().setDisplayShowHomeEnabled(false);
answered Oct 11, 2015 by vimaldas2005
0 votes

I used this and it worked for me.

        getActionBar().setIcon(
        new ColorDrawable(getResources().getColor(android.R.color.transparent)));
answered Oct 11, 2015 by thiru
0 votes
getActionBar().setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
getActionBar().setDisplayHomeAsUpEnabled(true);
answered Oct 11, 2015 by nimisha.jagtap
0 votes

I think the exact answer is: for api 11 or higher:

getActionBar().setDisplayShowHomeEnabled(false);

otherwise:

getSupportActionBar().setDisplayShowHomeEnabled(false);

(because it need a support library.)

answered Oct 11, 2015 by virendra.bajaj
0 votes

Qiqi Abaziz's answer is ok, but I still struggled for a long time getting it to work with the compatibility pack and to apply the style to the correct elements. Also, the transparency-hack is unneccessary. So here is a complete example working for v8 and up:

values\styles.xml



    
    

AndroidManifest.xml (shell)


" rel="nofollow" target="_blank">http://schemas.android.com/apk/res/android">   
    
    
        
    

answered Oct 11, 2015 by loknath.ganji
0 votes

go to your manifest an find the application tag

  android:icon="@android:color/transparent"// simply add this on place of your icon

..... ... ...

answered Oct 11, 2015 by patelnikul321
0 votes

Go in your manifest and find the your activity then add this code:

android:theme="@android:style/Theme.NoTitleBar"

above line hide your Actionbar .

If you need to other feature you can see other options with (CLR + SPC).

answered Oct 11, 2015 by jekbishnoi

...