Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ICS: Remove blue divider in ActionBar?

I am working on an app which will be full-screen, but will utilize some of the functionalities of the ActionBar. With the Ice Cream Sandwhich release, I see that I get a blue line divider/separator as part of the ActionBar. Normally, it would be good for consistency, but in my case I need to remove the divider.

How can I remove or style the divider of the ActionBar in ICS?

Tried setting a custom theme with "android:style/Widget.Holo.ActionBar" as parent. However, settings such as the one below has no effect

<item name="android:divider">#FFFFFF</item> 
like image 468
dparnas Avatar asked Jan 02 '12 19:01

dparnas


2 Answers

The graphic asset containing the blue bottom line is the background of the action bar's container view and is set to @android:drawable/ab_transparent_dark_holo when using the default Holo Dark theme.

To remove this line, you'll need to create a custom style for your action bar (based on Widget.Holo.ActionBar or Widget.Holo.Light.ActionBar (or the .Solid variants) and set the android:background to something that doesn't include the bottom border:

<style name="MyTheme" parent="android:Theme.Holo">   <item name="android:actionBarStyle">@style/MyActionBar</item> </style>  <style name="MyActionBar" parent="android:Widget.Holo.ActionBar">   <item name="android:background">@drawable/your_background_here</item> </style> 

Note: Holo Dark/Light action bars have solid and transparent styles; this blue line appears by default for the transparent style. Holo Dark action bars are transparent by default and Holo Light action bars are solid by default.

like image 125
Roman Nurik Avatar answered Oct 04 '22 16:10

Roman Nurik


Here is a simple way to remove the divider, works from API 07 using the actionbarcompat from the support library:

@Override public void onCreate(Bundle savedInstanceState) {         //...         getSupportActionBar().setBackgroundDrawable(             getResources().getDrawable(R.drawable.whatever_you_want));         //... }   
like image 28
Amir Uval Avatar answered Oct 04 '22 15:10

Amir Uval