gpt4 book ai didi

c# - 如何增加uwp中toastNotification的显示时间?

转载 作者:行者123 更新时间:2023-12-04 12:26:16 32 4
gpt4 key购买 nike

我正在使用 创建应用程序预定 Toast 通知 .我想增加通知的显示时间。如何设置显示通知的时间。还有其他选择吗?

最佳答案

根据documentation您可以使用 duration Toast 通知 XML 的属性,以便为 short 显示它(7s) 或 long (25s) 时间:

<toast duration="long">
<visual ... />
</toast>

This attribute was introduced back in Windows 8 time-frame for specifying how long the toast notification stays on the screen – setting the value to “short” will make the notification display for  ~7 seconds and setting it to “long” will make the notification display for ~25 seconds.

In Windows 10, developers have the following options to keep the notification on screen for longer than standard length (~7 seconds):

  • Specifying scenario attribute (see description below) to “alarm” or “reminder” to persist the notification on screen until the user dismisses it. 

  • Specify duration attribute to “long” while making sure the scenario attribute is specified to “default” or unspecified. This will result in the legacy behavior of notification showing on screen for ~25 seconds. 

    We do not recommend using this property unless you have a good reason to keep the notification up for ~25 seconds on screen. This attribute exists mainly for appCompat reason. 



此外,您可以创建一个 reminder通知以使其保持可见,直到用户与以下人员交互:
<toast scenario="reminder">
<visual ... />
</toast>

请注意文档中所述:

Do not use this just for keeping your notification persistent on screen.

关于c# - 如何增加uwp中toastNotification的显示时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40798377/

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