Remove action bar shadow

Drew

I want to remove the shadow that appears below the appcompat action bar so that the background of the action bar is completely transparent.

This is my theme and action bar style:

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

    <item name="android:actionBarStyle">@style/TransparentActionBar</item>
    <item name="android:windowActionBarOverlay">true</item>

    <!-- Support library compatibility -->
    <item name="actionBarStyle">@style/TransparentActionBar</item>
    <item name="windowActionBarOverlay">true</item>

</style>

<!-- Transparent Action Bar Style -->
<style name="TransparentActionBar"
    parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@android:color/transparent</item>

    <!-- Support library compatibility -->
    <item name="background">@android:color/transparent</item>
    <item name="elevation">0dp</item>
</style>

My minimum API level is 16

I've tried several solutions for this including:

  • Setting elevation to 0dp only works for Lollipop devices.
  • I get a "resource not found" error if I try to use windowContentOverlay
  • Setting the background of the root view to a color like white or transparent doesn't work

I've been trying to get this to work on 4.4.4 to no avail. Is it not possible below API level 21?

EDIT:

it turns out that the windowContentOverlay only works with the android prefix:

<item name="android:windowContentOverlay">@null<item/>

Trying to also define it without the prefix results in the resource not found error (this error points to the one with the prefix for whatever reason). I honestly don't understand why this occurs. I can only assume appcompat doesn't support the windowContentOverlay attribute.

Theo Lassonder

Set windowContentOverlay to a drawable that will be drawn under the action bar. If you don't want a shadow set it to null, like so:

<item name="android:windowContentOverlay">@null</item>

and

<item name="windowContentOverlay">@null</item>

This works API level 16 and up.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Remove shadow under action bar

From Dev

Remove shadow under action bar

From Dev

AppCompatActivity remove action bar shadow with style

From Dev

Android Action Bar elliptical shadow

From Dev

How to remove bar shadow in jqPlot bar chart

From Dev

How to remove bar shadow in jqPlot bar chart

From Dev

Remove Action Bar Android

From Dev

Remove Action Bar Android

From Dev

How to remove navigation bar border/shadow?

From Dev

How to remove the shadow above the app bar?

From Dev

How to remove the shadow of nav bar active

From Dev

Remove the frame, shadow and the title bar of the window

From Dev

How to remove the shadow line from a navigation bar?

From Dev

Unable to remove the shadow Image from navigation bar

From Dev

Android Studio - Action Bar remove

From Dev

Remove Action Button From Action Bar

From Dev

Remove Shadow Line Below Navigation Bar Without Removing Bar Color?

From Dev

Remove Shadow Line Below Navigation Bar Without Removing Bar Color?

From Dev

How do I add a shadow beneath my action bar in Android?

From Dev

How to remove the default shadow effect of navigation bar title in iOS 6

From Dev

How to remove the border for Share button in Action Bar?

From Dev

I want to remove the divider under the action bar

From Dev

Remove title from action bar activity

From Dev

Remove Title from Contextual Action Bar

From Dev

Remove pressed effect on action bar home icon

From Dev

How to remove the blue action bar in android?

From Dev

Remove Icon from Action Bar xamarin

From Dev

Cannot seem to remove Action bar programmatically or in XML

From Dev

iOS 9.0 - Remove top bar from UIAlertController action sheet

Related Related

HotTag

Archive