Android Action Bar not showing on displayOptions - useLogo

android, android-actionbar, android-styles, android-theme, graphical-logo

Solution

If you set the `android:logo` in the theme you shouldn't need to set it in code.

I think you may also need `showHome` in your display options e.g.

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

EDIT

Below is an example theme I use to hide the logo and display the title in the action bar, this sample is using `ActionBarSherlock` so you will need to adjust the parent style names accordingly if you aren't using it.

<style name="AppTheme" parent="style/Theme.Sherlock.Light.DarkActionBar">
   <item name="android:windowBackground">@color/background_primary</item>
   <item name="android:icon">@drawable/appicon</item>    
   <!-- For the home as up icon on sub pages -->
   <item name="android:homeAsUpIndicator">@drawable/back</item>
   <item name="homeAsUpIndicator">@drawable/back</item>          
   <item name="android:actionBarStyle">@style/AppTheme.ActionBar</item>
   <item name="actionBarStyle">@style/AppTheme.ActionBar</item>
</style>

<style name="AppTheme.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="android:displayOptions">showTitle</item>
<item name="displayOptions">showTitle</item>

<item name="android:titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>
<item name="titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>    
<item name="android:background">@color/actionbar_bg_color</item>
<item name="background">@color/actionbar_bg_color</item>
<item name="android:backgroundStacked">@color/actionbar_bg_color</item>
<item name="backgroundStacked">@color/actionbar_bg_color</item>

Problem

I have an `actionBarStyle` that I have implemented in my app for my `ActionBar`. Here is the xml code below: ``` <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="MyActionBarTheme" parent="@android:style/Theme.Holo"> <item name="android:windowActionBarOverlay">true</item> <item name="android:actionBarStyle">@style/MyCustomActionBar</item> </style> <style name="MyCustomActionBar" parent="@android:style/Widget.Holo.ActionBar"> <item name="android:background">@android:color/transparent</item> <item name="android:backgroundSplit">@android:color/transparent</item> <item name="android:displayOptions">useLogo</item> </style> ``` And here is my `Activity OnCreate`: ``` @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getActionBar().setLogo(R.drawable.ic_logo); setContentView(R.layout.activity_home); initializeViews(); manageFragments(); } ``` The Problem is that my `ActionBar` doesn't show at all and when I remove the `displayOptions` item from My XML. It shows with the title. Now I can always remove the title (set the title string to just blank) but I don't want that as it shows the default `ActionBar` style/theme for a few seconds and then my custom theme (I guess you know this one). I don't know what the problem is. Please help. Thanks...

Original source