Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
766 views
in Technique[技术] by (71.8m points)

android - I want to remove the divider under the action bar

What I'm trying to do is exactly as shown in the image" my problem

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...