上下文: 我正在使用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">更多推荐
在玩游戏时停止通知栏弹出
发布评论