我试图让一个机器人发射。我想实现一个完全透明的状态栏和导航栏,这里是我的主题xml文件。
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):
我想实现(新发射):
如何让状态栏和导航栏中的透明,而不是透明?
how to make the status bar and navigation bar "transparent" instead of "translucent"?
推荐答案
您可以编程实现对奇巧,之后通过设置该窗口
标记相同的效果
Update
You can achieve the same effect programatically on KitKat and afterwards by setting this Window
flag
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 it should be true
and not 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"
来源
相关推荐
最新文章