Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Flat ActionBar (without shadow)

Tags:

android

i'm trying to create the a flat action bar without shadow

attached image:

enter image description here

my style xml

<resources>

<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="@android:style/Theme.Holo.Light">
    <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:windowContentOverlay">@null</item>
            <item name="android:windowActionBarOverlay">true</item>

    <item name="android:background">@drawable/white_bg</item>
    <item name="android:displayOptions"></item>
</style>

I'm supporting android 4.x

Any ideas ? I tried changing the style to Solid/Inverse didn't work..

white_bg attached (It's hard to see since it's white)

enter image description here

like image 585
ibm123 Avatar asked Jan 11 '23 17:01

ibm123


2 Answers

it should look like this

<resources>

<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

<!-- ActionBar styles -->
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">

            <item name="android:windowActionBarOverlay">true</item>

    <item name="android:background">@drawable/white_bg</item>
    <item name="android:displayOptions"></item>
</style>
like image 156
SPatrickApps Avatar answered Jan 18 '23 06:01

SPatrickApps


The null windowContentOverlay attribute should be set on your Activity theme (CustomActionBarTheme), not on the ActionBar theme.

like image 39
Kevin Coppock Avatar answered Jan 18 '23 04:01

Kevin Coppock