Android 通知栏显示/隐藏切换

发布于 2024-10-10 04:24:15 字数 85 浏览 0 评论 0原文

我正在制作一个应用程序,我希望在其中切换通知栏显示/不显示。这可能吗?我已经知道如何设置按钮侦听器/覆盖按钮,但我只需要使之成为可能的 java 代码。谢谢

I am making an app where I would like the notification bar to be toggled for being show/ not being shown. Is that possible? I already know how to set button listener/override buttons but I just need the java code that makes that possible. Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世俗缘 2024-10-17 04:24:15
// Get a full-screen window
final Window win = getWindow();
win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);

请注意:

请注意,在创建窗口装饰之前必须设置一些标志(通过第一次调用 setContentView(View, android.view.ViewGroup.LayoutParams) 或 getDecorView()

来自 http://developer.android.com/reference/android/view/Window.html#setFlags(int,%20int )

// Get a full-screen window
final Window win = getWindow();
win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);

Be aware that:

Note that some flags must be set before the window decoration is created (by the first call to setContentView(View, android.view.ViewGroup.LayoutParams) or getDecorView()

From http://developer.android.com/reference/android/view/Window.html#setFlags(int,%20int)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文