I want to remove the divider under the action bar

独自空忆成欢 提交于 2019-12-18 09:01:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!