Search code examples
androidoverlaystatusbar

Image Overlay on Statusbar


I have added the primary dark color on the status bar to make it the color of my toolbar.

Coloured Status Bar

But I have a slide up panel with an image on the top (screenshot) which I need to overlay onto the status bar. Its currently like the screenshot below. Should be overlaying the image


Solution

  • Put the below in your AppTheme style in values-v21 folder (styles.xml) :

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:statusBarColor">@android:color/transparent</item>
    </style>
    

    By default, the status bar color is determined by "colorPrimaryDark". Apply the above theme to your specific activity in androidManifest.xml. (parent theme can be anything)