How to remove dividing line / shadow between status bar and main screen?

In my application, I would like to save the status bar, but make its background will be the same as on the main screen.

So, I created a special theme for setting the background of the application:

<resources> <style name="Theme.Shelves" parent="android:Theme"> <item name="android:windowBackground">@drawable/background_shelf</item> <item name="android:windowNoTitle">true</item> </style> </resources> 

Then put this in the manifest:

  <application android:icon="@drawable/icon" android:theme="@style/Theme.Shelves" android:label="@string/app_name"> <activity android:name=".HelloWorld" android:label="@string/app_name"> 

And get the following:

Screenshot 2

Everything is fine, except for the separator line between the status line and the main screen. I thought this was due to the addition of text, so I set it to zero, but nothing has changed.

 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello World"); setContentView(tv); tv.setPadding(0,0,0,0); } 

Please let me know if you have any idea about this. Thanks.

+4
source share
1 answer

Judging by your screenshot, "seperator" is actually a shadow status bar. I'm going from memory here, but I think you can disable it with:

 <item name="android:windowContentOverlay">@null</item> 

Sorry if the attribute name is a little wrong, as I said, comes from memory, but I think it is correct.

+9
source

Source: https://habr.com/ru/post/1335815/


All Articles