Shruthi
Shruthi

Reputation: 29

How to hide the logo on Sherlock action bar?

I want to remove the icon on action bar and i want to display only title. I did it by using

ActionBar.setDisplayUseLogoEnabled(false);

and

ActionBar.setDisplayShowHomeEnabled(false);

But the action bar is showing below the tab.so please help me how to solve the issue. thanks in advance.`

Upvotes: 0

Views: 120

Answers (2)

Blo
Blo

Reputation: 11978

Try this:

<style name="YourTheme" parent="@style/Theme.Sherlock.Light">
    <item name="android:actionBarStyle">@style/YourActionBar</item>
    <item name="actionBarStyle">@style/YourActionBar</item>
</style>

<style name="YourActionBar" parent="@style/Widget.Sherlock.Light.ActionBar">
    <item name="android:displayOptions">showTitle</item>
    <item name="displayOptions">showTitle</item>
</style>

And in your Activity:

ActionBar.setDisplayShowTitleEnabled(true);

It worked for me! Hope this help.

Upvotes: 0

Paul Lammertsma
Paul Lammertsma

Reputation: 38252

I haven't actually tried, but I believe you can specifying the display options in such a way as to only display the title:

actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE);

If you'd like to do it purely through XML, this answer recommends:

<item name="android:displayOptions">showHome|homeAsUp|showTitle</item>
<item name="displayOptions">showHome|homeAsUp|showTitle</item>
<item name="android:icon">@android:color/transparent</item>

Upvotes: 2

Related Questions