Search code examples
androidandroid-5.0-lollipop

Status bar has no shadow


I have tried to move my content below the status bar with success. Used the following code:

<resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowTranslucentStatus">true</item>
    </style>
</resources>

But the issue is that i have no status bar shadow. How do i achieve it? my result


Solution

  • shadows_bottom.xml design and color the way you like it to be

    <item name="android:windowContentOverlay">@drawable/shadows_bottom</item>
    

    Example shadows_bottom.xml

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item >
        <shape 
            android:shape="rectangle">
        <solid android:color="@android:color/darker_gray" />
        <corners android:radius="5dp"/>
        </shape>
    </item>
    <item android:right="1dp" android:left="1dp" android:bottom="2dp">
        <shape 
            android:shape="rectangle">
        <solid android:color="@android:color/white"/>
        <corners android:radius="5dp"/>
        </shape>
    </item>
    </layer-list>
    

    And you also need to set colorPrimary and colorPrimaryDark following official guidelines

    here: https://www.materialpalette.com