Search code examples
androidandroid-actionbaractionbarsherlockandroid-theme

Get rid of blue line


With the help of ActionBarSherlock I try to get my app running on pre 3.0 devices. There is a blue divider in the action bar, which I want to have removed.

strange blue line

I figured out that it isn't a divider, but part of the background graphic of the action bar. To get rid of the blue line I decided to override the background like this:

 <style name="MyActionBar" parent="android:Widget.Holo.ActionBar">
   <item name="android:background">@drawable/black</item>
   <item name="background">@drawable/black</item>
 </style>

I also set the background in the Java code:

getSupportActionBar().setStackedBackgroundDrawable(this.getResources().getDrawable(R.drawable.black));

As a result the blue line disappears on 4.x devices, but is still visible on 2.3.x devices. How do I get rid of the blue line on 2.3.x devices?


Solution

  • Stupid mistake: I used setStackedBackgroundDrawable instead of setBackgroundDrawable. It works fine with setBackgroundDrawable. This is the correct method to set the background of the action bar. setStackedBackgroundDrawable sets the background of the tab bar.