锁屏解锁后隐藏的通知栏重新出现

发布于 2024-12-20 04:04:25 字数 202 浏览 3 评论 0原文

我通过将主题更改为我成功隐藏了通知栏来隐藏了我的活动的通知栏

Theme.NoTitlebar.FullScreen and then changed it in my manifest too.

。但是,如果我在同一活动中锁定然后再次解锁屏幕,通知栏就会变得可见。我该如何克服这个问题? 我想在整个活动过程中隐藏通知栏。

I hid my notification bar for my activity by changing the theme to

Theme.NoTitlebar.FullScreen and then changed it in my manifest too.

I successfully hid the notification bar. But if I lock and then again unlock the screen when in the same activity, the notification bar becomes visible. How do I overcome this?
I want to hide my notification bar throughout my activity.

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

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

发布评论

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

评论(1

吃素的狼 2024-12-27 04:04:25

我使用 TabHost 时也遇到同样的问题。以下是解决此问题的方法:

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        getWindow().getDecorView().postDelayed(new Runnable() {

            @Override
            public void run() {
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
            }
        }, 100);
    }
}

首先使用通知栏绘制此图,并在 ms 后重新绘制。

如果您不使用 TabHost,这是最好的解决方案。

I have same problem when I use TabHost. Here are a workaround for this problem:

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        getWindow().getDecorView().postDelayed(new Runnable() {

            @Override
            public void run() {
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
            }
        }, 100);
    }
}

This is drawn first with the notification bar and redrawn after the ms.

The best solution, if you don't use TabHost.

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