我如何能保持动作/标题栏,但隐藏通知栏 [英] How can I keep the action/title bar but hide the notification bar

查看:181
本文介绍了我如何能保持动作/标题栏,但隐藏通知栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何能保持动作/标题栏,但隐藏通知栏?

How can I keep the action/title bar but hide the notification bar?

这个问题看起来已经回答了,但大部分的答案我发现了隐藏在这两个操作栏和通知栏。我希望能够保持动作/标题栏。我已经得到了最好的藏身两者并用线性布局,以显示自定义操作/标题栏,但我希望有一个系统生成的。也就是有可能只是隐藏操作栏,而显示的通知栏?

This question looks like it has already been answered but most of the answers I found hide both the action bar and the notification bar. I want to be able to keep the action/title bar. The best I've gotten is hiding both and using a linear layout to display a custom action/title bar but I want a system generated one. Also is it possible to hide just the action bar whilst displaying the notification bar?

推荐答案

要隐藏通知栏使用后续的code:

To hide the notification bar use the follow code:

WindowManager.LayoutParams attrs = act.getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
act.getWindow().setAttributes(attrs);

要显示的通知栏使用后续的code:

To show the notification bar use the follow code:

WindowManager.LayoutParams attrs = act.getWindow().getAttributes();
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
act.getWindow().setAttributes(attrs);

您很可能希望调用Activity.onCreate的code()。

You'd probably want to call the code in Activity.onCreate().

这篇关于我如何能保持动作/标题栏,但隐藏通知栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆