Remove application icon and title from Honeycomb action bar

AndroidAndroid ActionbarAndroid 3.0-Honeycomb

Android Problem Overview


How can I remove the application icon & title which comes by default in an action bar?

There is a similar question here: https://stackoverflow.com/questions/5030700/can-i-hide-the-app-icon-from-the-action-bar-in-honeycomb, but it doesn't talk about how to do it?

Android Solutions


Solution 1 - Android

Call setDisplayShowHomeEnabled() and setDisplayShowTitleEnabled() on ActionBar, which you get via a call to getActionBar().

Solution 2 - Android

If you want to do it the XML way, then define a style (XML file) in the /res/values-v11/ folder with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<resources>
	<style name="MyTheme" parent="android:style/Theme.Holo">
		<item name="android:actionBarStyle">@style/MyActionBarStyle</item>
	</style>

	<style name="MyActionBarStyle" parent="@android:style/Widget.Holo.ActionBar">
		<item name="android:displayOptions"></item>
	</style>
</resources>

In your AndroidManifest.xml set the theme defined above for your activity:

<activity
	...
	android:theme="@style/MyTheme">
	...
</activity>

This will remove the icon and the title and only display the action items. If you just want the title to be displayed, the use:

<item name="android:displayOptions">showTitle</item>

Or just the application logo:

<item name="android:displayOptions">showHome</item>

Or both (default)

<item name="android:displayOptions">showHome|showTitle</item>

Other options are available too, like: showCustom, useLogo, homeAsUp

Solution 3 - Android

Try

getActionBar.setIcon(R.color.transparent);

Solution 4 - Android

This will help you:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ActionBar actionBar = getActionBar();
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);

        //the rest of your code...
}

Solution 5 - Android

actionBar.setIcon(R.color.transparent);

actionBar.setTitle("");

Solution 6 - Android

Try this in onCreate()

ActionBar actionbar=getSupportActionBar();
actionbar.setDisplayHomeAsUpEnabled(false);
actionbar.setIcon(android.R.color.transparent);

user android.R.color.transparent

Solution 7 - Android

> Try this combination

    getSupportActionBar().setHomeButtonEnabled(false);
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	getSupportActionBar().setDisplayShowHomeEnabled(false);
	getSupportActionBar().setIcon(R.color.transparent);
	getSupportActionBar().setDisplayShowTitleEnabled(true)

Solution 8 - Android

If you are looking to simply remove the entire actiobar, you can try the hide method for actionBars:

getActionbar().hide();

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionprashantView Question on Stackoverflow
Solution 1 - AndroidCommonsWareView Answer on Stackoverflow
Solution 2 - AndroidBert RegelinkView Answer on Stackoverflow
Solution 3 - AndroidAdíView Answer on Stackoverflow
Solution 4 - AndroidPedro LobitoView Answer on Stackoverflow
Solution 5 - AndroidHossein AminiView Answer on Stackoverflow
Solution 6 - AndroidVrajeshView Answer on Stackoverflow
Solution 7 - AndroidSatheeshView Answer on Stackoverflow
Solution 8 - Androidsmac89View Answer on Stackoverflow