1

I have defined a relativeLayout with a recyclerView and an imageView. I want the imageView to draw behind the status bar. But for some reason

android:fitsSystemWindow = true

doesn't work.
How can I achieve it?

Filnor
  • 1,290
  • 2
  • 23
  • 28
Ashutosh Patoa
  • 294
  • 4
  • 20
  • 1
    Possible duplicate of [Lollipop : draw behind statusBar with its color set to transparent](https://stackoverflow.com/questions/27856603/lollipop-draw-behind-statusbar-with-its-color-set-to-transparent) – Anonymous Apr 19 '18 at 11:42

2 Answers2

2

Set your full-screen theme like following

  <style name="Theme.MyApp.FullScreen" parent="Theme.MyApp">
    <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
    <item name="android:windowTranslucentStatus">false</item>
    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>   
 </style>

Don't add android:fitsSystemWindows="true" in your layout file

Also, no need to add android:windowSoftInputMode="adjustPan" in Manifest file

Rinkesh
  • 3,150
  • 28
  • 32
1

To draw behind status bar, You have to set your status bar have transparent background.

So, you need to set this with adding below proprieties in your theme:

<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>

And in your .xml you have already set below property which is useful:

android:fitsSystemWindows="true"
Janvi Vyas
  • 732
  • 5
  • 16