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

由网友(ζ??、魚忘七秒℡)分享简介:我如何能保持动作/标题栏,但隐藏通知栏?How can I keep the action/title bar but hide the notification bar?这个问题看起来已经回答了,但大部分的答案我发现了隐藏在这两个操作栏和通知栏。我希望能够保持动作/标题栏。我已经得到了最好的藏身两者并用线性布局,...

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

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().

阅读全文

相关推荐

最新文章