I am setting image as window background:
<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:windowBackground">@drawable/bg_window</item>
</style>
It works for tablets and fullscreen windows:
but on the handset it is clipped by status bar:
Is this the way things work? How do I avoid it? Of course, I could set the background for each layout, but I want to know if this the only way to solve the problem.
My solution to this problem (at least for phones) was to create a xml drawable with the statusbar height as the top offset
e.g. drawable/window_background.xml:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:top="25dp">
<bitmap android:src="@drawable/some_background" />
</item>
</layer-list>
This will not work, if the status bar is on the bottom though.
EDIT: edited the answer to use a single xml drawable, as sugested by Aleksejs Mjaliks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With