Android ICS: Remove blue divider in ActionBar?
Asked Answered
P

4

31

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>
Progesterone answered 2/1, 2012 at 19:52 Comment(1)
This may help: #6072726 Also, did you remember to select your custom theme in the Manifest or your code?Celestyna
M
65

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.

Mukden answered 4/1, 2012 at 16:28 Comment(3)
the android:Theme.Holo is only for API 11. How can I do this for older APIs.Carniola
Note: setting <item name="android:background">@android:color/transparent</item> will remove the divider.Mccants
As @androider said only for API 11. To use it for lower API use support library v7. For the first block parent="Widget.AppCompat.Light"for the second block parent="Widget.AppCompat.Light.ActionBar" (or instead of Light Base or Dark) You will also need to use <item name="actionBarStyle"> instead of <item name="android:actionBarStyle">Unseasoned
J
2

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));
        //...
}  
Jonijonie answered 8/10, 2013 at 14:17 Comment(0)
R
1

Changing the activity theme to Theme.Holo.Light.DarkActionBar removes the blue line.

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:windowBackground">@android:color/black</item>
    <item name="android:textColor">@android:color/white</item>
</style>

If you still want a black background you may want to change android:windowBackground and/or android:textColor

Rhizobium answered 15/7, 2014 at 14:16 Comment(0)
C
-2

add this <item name="android:windowContentOverlay">@null</item> to your app theme.

Consultative answered 9/8, 2014 at 15:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.