1

I've been trying to make the status bar on phones with Android version 5.0+ translucent, but to no avail. It works, but there's a shadow on it.

Here's my styles.xml:

<resources>

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

<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

Here's my styles.xml (v21):

<resources>>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

Any idea how I'm supposed to fix this problem? I tried calling setVerticalFadingEdgeEnable(false) on the CoordinatorLayout and the AppBarLayout, but the shadow still appears on the status bar. Any help would be appreciated.

Thanks in advance.

Anuj G.R
  • 121
  • 4

1 Answers1

-1

This shadow is part of windowContentOverlay on APIs below LOLLIPOP (on LOLLIPOP it's @null).

When you work with Toolbar widget the toolbar isn't part of window decor anymore so the shadow starts at the top of the window over the toolbar instead of below it (so you want the windowContentOverlay to be @null). Additionally you need to add an extra empty View below the toolbar pre-LOLLIPOP with its background set to a vertical shadow drawable (8dp tall gradient from #20000000 to #00000000 works best). On LOLLIPOP you can set 8dp elevation on the toolbar instead.

For more detail visit Toolbar's shadow on status bar for Lollipop

Community
  • 1
  • 1
Harshad
  • 1,344
  • 1
  • 10
  • 25
  • 1
    I set the windowContentOverlay to @null and set 0dp elevation on the toolbar. It still displays the shadow. – Anuj G.R Jan 30 '16 at 09:30
  • visit this for more .. http://stackoverflow.com/questions/26575197/no-shadow-by-default-on-toolbar/31026359#31026359 – Harshad Jan 30 '16 at 09:48