问题
What I'm trying to do is exactly as shown in the image"
I want to remove this divider. I'm using the android built-in action bar. I don't want to use Sherlock Action Bar. I have to use android action bar.
I have tried to add this to my styles but its not working
<style name="MyDropDownNav" parent="android:style/Theme.Holo.Light">
<item name="android:dropDownSelector">@drawable/ic_launcher</item>
<item name="android:divider">@null</item>
</style>
Do you have any suggestions?
回答1:
You can implement a Translucent Action Bar:
Custom Translucent Android ActionBar
Show ImageView partly behind transparent ActionBar
Define themes:
<resources>
<style name="Theme.TranslucentActionBar" parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/Widget.ActionBar</item>
</style>
<style name="Theme.TranslucentActionBar.ActionBar" />
<style name="Theme.TranslucentActionBar.ActionBar.Overlay">
<item name="android:actionBarStyle">@style/Widget.ActionBar.Transparent</item>
<item name="android:windowActionBarOverlay">true</item>
</style>
</resources>
and styles for your Action Bar:
<resources>
<style name="Widget.ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/ab_background</item>
</style>
<style name="Widget.ActionBar.Transparent">
<item name="android:background">@android:color/transparent</item>
</style>
</resources>
Then apply it in your AndroidManifest.xml.
回答2:
<style name="AppTheme" parent="android:Theme.whatever_theme_you_have">
...
<item name="android:windowContentOverlay">@null</item>
</style>
回答3:
The divider is contained for actionbar background image.
Try to change actionbar background image. Please refer to below codes.
<style name="AppTheme">
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
</style>
<style name="ActionBarStyle">
<item name="android:background">{SET BACKGROUND FOR YOU}</item>
</style>
来源:https://stackoverflow.com/questions/18950839/i-want-to-remove-the-divider-under-the-action-bar