在玩游戏时停止通知栏弹出

编程入门 行业动态 更新时间:2024-10-27 17:12:19
本文介绍了在玩游戏时停止通知栏弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

上下文: 我正在使用XNA 4.0框架开发Windows Phone游戏.在游戏过程中,如果用户不小心拖动了屏幕顶部,则通知中心将被向下拖动.

Context: I am working on a windows phone game using XNA 4.0 framework. During the gameplay, if the user accidentally drags the top of screen, notification center gets dragged down.

我看到很少有应用程序可以覆盖此行为,而不是弹出通知中心,而是在顶部显示了一个小提示,如下面的屏幕快照所示.

I have seen few apps where this behaviour is overridden and instead of notification center popping up, a small cue is shown at the top as shown in the screenshot below.

问题: 当用户在游戏过程中不小心拖动屏幕顶部时,阻止通知中心出现的API是什么?

Question: What is the API that stops notification center to come up when user accidentally drags the top of screen during gameplay?

我想要实现的屏幕截图:

在 WP论坛也正在等待正确的解决方案.

Same question asked on WP forum also but waiting for correct solution.

推荐答案

要隐藏通知栏,您需要做两件事:

To hide the notification bar, you need to do two things:

  • 将您的应用设置为全屏显示
  • 将系统托盘隐藏在页面中
  • 您可以通过更改RootFrame的FullScreen属性将应用程序设置为全屏显示.例如,可以在App构造函数的App.xaml.cs文件中完成此操作:

    You can set your application as full screen by changing the FullScreen property of your RootFrame. This can be done for instance in the App constructor, in the App.xaml.cs file:

    public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard XAML initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Hide the notification bar // Note: this must be done *after* InitializePhoneApplication RootFrame.FullScreen = true; // Language display initialization InitializeLanguage(); }

    然后,还必须通过设置SystemTray.IsVisible属性来隐藏页面上的系统托盘.这可以在C#代码或XAML中完成:

    Then, you also have to hide the system tray on your pages, by setting the SystemTray.IsVisible property. This can be done either in the C# code or in the XAML:

    <phone:PhoneApplicationPage x:Class="SL8._1.MainPage" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" shell:SystemTray.IsVisible="False">

    更多推荐

    在玩游戏时停止通知栏弹出

    本文发布于:2023-06-04 19:06:04,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/503304.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:弹出   玩游戏   通知

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!