Sonhja
Sonhja

Reputation: 8448

How to remove ActionBar shadow?

I'm trying to remove ActionBar shadow that appears in this image:

enter image description here

Since now I've tried to add these lines in my xml theme:

 <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" >
    <item name="android:windowContentOverlay">@null</item>
</style>

And do it programmatically like this:

getSupportActionBar().setElevation(0);

as posted here.

But nothing is working for me...

My device is using last version of Android. Any idea on why is not working?

Upvotes: 2

Views: 1311

Answers (2)

Collins Abitekaniza
Collins Abitekaniza

Reputation: 4578

Try using

<style name="AppTheme" parent="android:Theme.Holo.Light">
....
</style>

<style name="NoActionBarShadowTheme" parent="AppTheme">
    <item name="windowContentOverlay">@null</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

And in manifest

<activity
    android:theme="@style/NoActionBarShadowTheme"

And if you are using material design,try setting your toolbar elevation to 0dp.

Upvotes: 0

Michele Lacorte
Michele Lacorte

Reputation: 5363

Add this property to your Toolbar or AppBarLayout (I don't know if you are using AppBarLayout):

app:elevation="0dp"

Upvotes: 3

Related Questions