0

I would like to show transparent status bar without using immersive mode. Just like the image below. I have tried lot of solutions however I'm unable to achieve this. Please refer the image below.

enter image description here

This is the output I'm looking for. Please note here that I'm looking for solution which doesn't affect navigation bar at all. I don't want any modifications to navigation bar just like image below. Thanks in advance!

My theme:

<style name="AppTheme" parent="@style/Theme.MaterialComponents.DayNight.NoActionBar.Bridge">
<item name="android:colorEdgeEffect">@color/color_subtitle_text</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">true</item>
Halil Ozel
  • 2,482
  • 3
  • 17
  • 32
Vijay E
  • 829
  • 10
  • 14
  • 1
    i think you looking like following https://stackoverflow.com/questions/29069070/completely-transparent-status-bar-and-navigation-bar-on-lollipop – Uday Dodiya Sep 05 '22 at 12:07
  • Thanks for the link however I'm unable to achieve full screen with transparent status bar with this link. It only shows how we can achieve transparent status bar. Right now I'm unable to draw anything on status bar. it is always dark color. Im using @style/Theme.MaterialComponents.DayNight.NoActionBar.Bridge theme – Vijay E Sep 05 '22 at 12:14
  • you can extend that theme and add extra things into that – Rohit Sep 05 '22 at 12:36
  • Im adding more info on what I have done with theme. – Vijay E Sep 05 '22 at 12:39

2 Answers2

1

try this:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Halil Ozel
  • 2,482
  • 3
  • 17
  • 32
  • This is not working. This will make navigation bar transparent. I only need statusbar as transparent. – Vijay E Sep 06 '22 at 17:33
0

You can use like this.

For Kotlin:

window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)

For Java:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Halil Ozel
  • 2,482
  • 3
  • 17
  • 32