gpt4 book ai didi

xna - 停止通知栏在游戏过程中弹出

转载 作者:行者123 更新时间:2023-12-04 15:58:12 25 4
gpt4 key购买 nike

上下文:
我正在使用 XNA 4.0 框架开发 Windows 手机游戏。在游戏过程中,如果用户不小心拖拽了屏幕顶部,通知中心就会被拖下。

我见过的应用程序很少覆盖此行为,而不是弹出通知中心,而是在顶部显示一个小提示,如下面的屏幕截图所示。

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

我想要实现的截图:

notification center cue at the top

WP forum 上问了同样的问题也在等待正确的解决方案。

最佳答案

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

  • 将您的应用程序设置为全屏
  • 隐藏页面中的系统托盘

  • 您可以通过更改 FullScreen 将您的应用程序设置为全屏模式。您的 RootFrame 的属性。例如,这可以在 App 构造函数中的 App.xaml.cs 文件中完成:
    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 来隐藏页面上的系统托盘。属性(property)。这可以在 C# 代码或 XAML 中完成:
    <phone:PhoneApplicationPage
    x:Class="SL8._1.MainPage"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    shell:SystemTray.IsVisible="False">

    关于xna - 停止通知栏在游戏过程中弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23978951/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com