如何使用xml文件使状态栏和导航栏透明
我正在做一个项目,需要状态栏和导航栏是透明的。
我已将状态栏设置为透明,但无法对导航栏执行相同的操作。
谁能帮我解决这个问题。谢谢
我已经设置了这样的样式:
<style name="AppTheme.ActionBar.Transparent" parent="AppTheme">
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
注意:我只是在 style.xml 文件中完成了它,因为我已经有了使用该标志的完整版本
I'm doing a project that needs the status bar and the navigation bar to be transparent.
I have made the status bar transparent but I am not able to do the same with the navigation bar.
Can anyone help me with this problem. thank
I have set a style like this :
<style name="AppTheme.ActionBar.Transparent" parent="AppTheme">
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
note:I just did it in the style.xml file because I already have a complete version that uses the flag
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在活动类 onCreate 方法中放置此代码
in activity class onCreate method put this code
使用导航或状态栏背景颜色代码 #00000000 或 android:background="?android:attr/selectableItemBackground"
这些可以是透明背景,如按钮等......
希望它能起作用
using navigation or status bar background color code #00000000 or android:background="?android:attr/selectableItemBackground"
these can transparent background like button,etc...
hope it will work