completely transparent status bar and navigation bar on lollipop
I'm trying to make an android launcher. I want to achieve a completely transparent status bar and navigation bar, here is my theme xml file.
<resources>
<style name="Theme" parent="android:Theme.Material.Wallpaper.NoTitleBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowTranslucentNavigation">false</item>
</style>
</resources>
the last two items don't work, there is still a shadow on lollipop.
This is what it looks like(note there is actually a shadow on status bar and navigation bar):
what I want to achieve (nova launcher):
how to make the status bar and navigation bar "transparent" instead of "translucent"?
Update
You can achieve the same effect programmatically on KitKat and afterward by setting the FLAG_LAYOUT_NO_LIMITS
flag inside the Window
.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow(); // in Activity's onCreate() for instance
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
If you set a background resource (like a color or a picture) to your layout, you will see the color or picture "below" the status bar.
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/primary_dark</item>
Original Answer
It looks like android:windowTranslucentStatus
and android:windowTranslucentNavigation
should be true
instead of false
<resources>
<style name="Theme" parent="android:Theme.Material.Wallpaper.NoTitleBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
</resources>
Also, your transparent activity / container layout needs this property set:
android:fitsSystemWindows="true"
[Source][1] [1]: https://stackoverflow.com/a/29311321/1549700
I use this since it keeps the height of the status bar and nav bar
<!-- Base application theme. -->
<style name="theme" parent="android:Theme.Material.Wallpaper.NoTitleBar">
<item name="android:navigationBarColor">#00000000</item>
<item name="android:statusBarColor">#00000000</item>
</style>
This does require API 21+ however
For API 29 and above use
<style name="Your.Theme">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:enforceNavigationBarContrast">false</item>
</style>