Remove application icon and title from Honeycomb action bar

61,022

Solution 1

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

Solution 2

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

Try

getActionBar.setIcon(R.color.transparent);

Solution 4

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

actionBar.setIcon(R.color.transparent);

actionBar.setTitle("");
Share:
61,022
prashant
Author by

prashant

SOreadytohelp

Updated on July 08, 2022

Comments