在Metro App中显示Toast notification
Toast notification是向用户显示一些有关App的即时消息。具体Toast notification是什么可以参考
http://msdn.microsoft.com/en-us/library/windows/apps/hh465360(v=VS.85).aspx
创建Toast notification步骤:
1.在Package.appxmanifest文件中设置ToastCapable="true",否则Toast Notification不能显示。
<VisualElements ForegroundText="light" BackgroundColor="#000000" ToastCapable="true">
ForegroundText标签表示Toast notification消息文字的样式(有dark和light两种),BackgroundColor
标签表示Toast notification的背景颜色。
2.下面是显示Toast notification的代码:
private void ShowToast()
{
// GetTemplateContent returns a Windows.Data.Xml.Dom.XmlDocument object containing
// the toast XML
XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText04);
XmlElement xe = toastXml.CreateElement("title");
// You can use the methods from the XML document to specify all of the
// required parameters for the toast
XmlNodeList stringElements = toastXml.GetElementsByTagName("text");
for (uint i = 0; i < stringElements.Length; i++)
{
stringElements.Item(i).AppendChild(toastXml.CreateTextNode("Pressed Screenshot key !"));
}
// Create a toast from the Xml, then create a ToastNotifier object to show
// the toast
ToastNotification toast = new ToastNotification(toastXml);
// If you have other applications in your package, you can specify the AppId of
// the app to create a ToastNotifier for that application
ToastNotificationManager.CreateToastNotifier().Show(toast);
}
完成上面两步后,调用ShowToast方法就会在右下角显示一个Toast notification。
在Metro App中显示Toast notification相关推荐
- adpater里写toast_如何在Android中显示Toast?
要在您的应用程序中显示Toast,请尝试以下操作:Toast.makeText(getActivity(), (String)data.result, Toast.LENGTH_LONG).show( ...
- Android 9.0 APP中显示导航栏的menu键
PS:以前 Android 4.0 时代,写了个APP,用屏幕底部菜单键提供两个刷新及退出按钮,但是现在 android 动不动就更新下,现在我手机已经到 9.0 版了,原来的导航栏三个小点点菜单键 ...
- 在非UI线程中显示Toast
Toast的显示依赖于当前线程中的Handler,而Handler的创建必须有Looper,在UI线程中,系统自动为我们创建了Looper对象.因而在子线程中,我们必须手动的去创建Looper对象. ...
- Metro App中使用Timer
在设定的时间结束后,执行相应的方法. 使用metro的Windows.System.Threading命名空间下的ThreadPoolTimer类,可以创建一个Timer. Creat ...
- App中显示html网页
在如今的移动开发中,越来越多的web元素加入到了app里面,hybrid app能够综合native app 和 web app的优点,可以通过webView实现 htmllayout.xml: &l ...
- android读取带公章的pdf文件,APP中如何显示带电子签名的PDF文件
之前碰到一个需求,需要在手机 APP 中显示 pdf 文件.经过调研发现,在电脑上的浏览器如 chrome.safari等,可以直接显示 pdf 文件.由此联想到,在 APP 中能否通过浏览器来加载显 ...
- 在IntentService中使用Toast与在Service中使用Toast的异同,intentservicetoast
在IntentService中使用Toast与在Service中使用Toast的异同,intentservicetoast 1. 表象 Service中可以正常显示Toast,IntentServic ...
- Windows 8 Metro App开发[8]处理Fullscreen, Snapped和Filled状态
注:本系列学习帖子我在DevDiv.com移动开发社区原创首发 转载请注明出处:BeyondVincent(破船)@DevDiv.com 如果你有什么问题也可以前往交流 下面是首发地址: [DevDi ...
- app中的webview是什么?如何理解?
app中的webview是什么?如何理解? 当你上网阅读东西时,我们一般会选择一款浏览器,比如Chrome.火狐.safari.IE或者Edge.你可能不知道这些浏览器之间有一些竞争,而竞争的主要形式 ...
最新文章
- Azure正式对外发布容器服务,支持Swarm和Mesos
- ActiveX 控件导入程序
- 分支结构||分支循环结构||使用原生js遍历对象
- 手动删除oracle 归档文件,Oracle手动删除归档日志厚,出现ORA-19571错误
- linux cpu softirq,linux softirq机制
- php知识点汇总与解答_PHP操作员能力倾向问题与解答
- 学Python前途如何,带你了解Python的优势!
- pycharm连接mysql1193错误_pycharm连接mysql数据库提示错误的解决方法_数据库
- HDU1285确定比赛名次(拓扑排序+优先队列)
- srs部署到ubuntu 18.04 server
- udacity 的如何使用git课程终于找出merge master和coins时候的问题了
- 网站后台测试软件,WebCrack:网站后台弱口令批量检测工具
- sqlite3命令行基本操作
- 马云回应豪宅谣言;淘宝上线了三架波音747进行拍卖;迪拜投1.4亿美元建模拟火星丨价值早报
- libSVM简介及核函数模型选择
- David Lowe 的sift代码
- 每日一题_447.回旋镖的数量
- PowerShell 实现企业微信机器人推送消息
- 计算机实践教程采莲趣事,计算机基础作业采莲趣事
- 计算机老是重启进不了桌面,电脑开机反复重启怎么回事 电脑开机后进不去桌面界面全黑...
热门文章
- mysql Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nona
- Oracle Data Gurad Physical Standby 相关说明
- [Android] 触屏setOnTouchListener实现图片缩放、移动、绘制和添加水印
- Python之字符串的134个常用操作
- HarmonyOS之深入解析编译构建的配置和代码混淆
- iOS之从N个数里面取M个数的组合算法
- 2016年第七届蓝桥杯 - 省赛 - C/C++大学A组 - H. 四平方和
- 阿里面试官问我,你们的需求研发/开发流程是怎样的?我???
- 一入爬虫深似海,反爬技术你知多少?
- 计算机网络——IP地址与MAC地址