Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one remove the separator line / shadow between status bar and main screen?

In my application, I'd like to keep status bar but make its background be the same as the main screen.

So I created a custom theme to set application background:

<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 it in 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 this one:

Screen shot 2 http://i1178.photobucket.com/albums/x370/BinhNguyen84/device.png

Everything is okay except the separator line between status bar and main screen. I thought that it's because of text view padding, so I set it to zero but nothing 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);
}
like image 816
thanhbinh84 Avatar asked Jan 21 '23 17:01

thanhbinh84


1 Answers

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

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

Apologies if the attribute name is slightly wrong, as I say, going from memory but I think it's right.

like image 164
C0deAttack Avatar answered Jan 29 '23 23:01

C0deAttack