Search code examples
androidandroid-actionbaractionbarsherlock

Actionbar occupies entire screen when home button is displayed


I faced this problem while using ActionBar and struggled to find the solution,found it with help from others and a lot of searching.

So, this was the problem, I wanted to display the home button and title in the ActionBar and used

actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayUseLogoEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);

Well this should work theoretically, but it didnt. for some reason the "setDisplayShowHomeEnabled(true);" also made the action bar occupy the entire screen.

so i had to solve this problem.


Solution

  • the answer to this was to change the style the actionBar got it from.

    i was originally using

    <style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar.Solid">
                <item name="android:background">#000000</item>                                           
    </style>
    

    Later changed it to

    "@android:style/Widget.Holo.ActionBar
    

    This appears in actionbar Sherlock too, this is where the solution was found.

    and this helped solve the problem. So anyone facing a similar scenario,pls try changing the style. Hope this helps.