How to remove separator from action bar in Android?
I am integrating a custom view for an action bar. However, I am unable to remove the action bar separator. Any suggestion will be greatly appreciated. Thank.
I am applying theme in my manifest like this:
<application
android:theme="@style/AppTheme"
...
Inside themes.xml
I have:
<style name="AppBaseTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:textColorPrimary">@color/mytheme_primary</item>
<item name="android:textColorSecondary">@color/mytheme_secondary</item>
<item name="android:textColorTertiary">@color/mytheme_tertiary</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarDivider">@android:color/transparent</item>
<item name="android:ratingBarStyle">@style/RatingBarAppTheme</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/bg_action_bar</item>
<item name="android:actionBarDivider">@android:color/transparent</item>
</style>
Although I set the action bar divider to be two-piece transparent, but it doesn't seem to take effect :(
+3
source to share
2 answers
I have the same problem. Set windowContentOverlay to null so it has no delimiter.
In your xml style file, put this:
<item name="android:windowContentOverlay">@null</item>
and become
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:actionBarDivider">@android:color/transparent</item>
<item name="android:ratingBarStyle">@style/RatingBarAppTheme</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="android:windowContentOverlay">@null</item>
</style>
+1
source to share