美度手表网站,赛尔网络公司好不好,阳春做网站公司,珠海网络公司联系方式一、设备类是Xamarin重要开发组成部分#xff0c;下面介绍一下设备类的主要用法#xff1a; //唤醒打电话Device.OpenUri(new Uri(tel:180xxxxxxxx));//打开网页Device.OpenUri(new Uri(http://vipstone.cnblogs.com/));//判断当前运行平台Device.Ru…一、设备类是Xamarin重要开发组成部分下面介绍一下设备类的主要用法 //唤醒打电话
Device.OpenUri(new Uri(tel:180xxxxxxxx));
//打开网页
Device.OpenUri(new Uri(http://vipstone.cnblogs.com/));
//判断当前运行平台
Device.RuntimePlatform Device.iOS, Device.Android, Device.WinPhone
//设备类型平板、手机、桌面
Device.Idiom TargetIdiom.Phone, TargetIdiom.Tablet, TargetIdiom.Desktop
//计数器延迟执行
Device.StartTimer (new TimeSpan (0, 0, 60), () {
// do something every 60 seconds
return true; // runs again, or false to stop
});
更多Device相关信息请访问https://developer.xamarin.com/guides/xamarin-forms/platform-features/device/
二、第三方弹窗模态窗口
先看效果图
模态窗口git地址https://github.com/rotorgames/Rg.Plugins.Popup
基本实现核心代码 ?xml version1.0 encodingutf-8 ?
pages:PopupPage xmlnshttp://xamarin.com/schemas/2014/forms
xmlns:xhttp://schemas.microsoft.com/winfx/2009/xaml
x:Classywgoapp.Pages.Upgrade.UpgradePrompt
xmlns:pagesclr-namespace:Rg.Plugins.Popup.Pages;assemblyRg.Plugins.Popup
StackLayout VerticalOptionsCenter WidthRequest290 HorizontalOptionsCenter Spacing0
AbsoluteLayout VerticalOptionsStart
Image Sourceupgrade_bgtop.png WidthRequest290 AbsoluteLayout.LayoutFlagsPositionProportional AbsoluteLayout.LayoutBounds0,0/Image
Label x:Namelb_version Text版本升级 AbsoluteLayout.LayoutFlagsXProportional AbsoluteLayout.LayoutBounds0.5,74 FontSize16 TextColorWhite/Label
Image x:Nameimg_close IsVisibleFalse Sourceclose3.png HeightRequest24 WidthRequest24 AbsoluteLayout.LayoutFlagsXProportional AbsoluteLayout.LayoutBounds.96,52
Image.GestureRecognizers
TapGestureRecognizer TappedOnCloseTap/TapGestureRecognizer
/Image.GestureRecognizers
/Image
/AbsoluteLayout
ScrollView Padding30,20 MinimumHeightRequest160 BackgroundColorWhite
Label x:Namelb_content Text FontSize12/Label
/ScrollView
StackLayout Padding50,0,50,10 BackgroundColorWhite
Button Text立即升级 BackgroundColor#4BC1D2 TextColorWhite ClickedButton_Clicked
/Button
/StackLayout
StackLayout Spacing0
Image Sourceupgrade_bgbottom.png WidthRequest290 AspectAspectFill/Image
/StackLayout
/StackLayout
/pages:PopupPage
调用代码 this.Navigation.PushPopupAsync(new UpgradePrompt());
弹窗要注意的点
1.不想点击任何区域都消失的话需要重新OnBackgroundClicked事件return false
2.手动关闭窗体PopupNavigation.PopAsync() Xamarin系列其他推荐 《Xamarin开发笔记—WebView双项事件调用》《Xamarin开发笔记—百度在线语音合成》《Xamarin开发笔记—设备类第三方弹窗的使用和注意事项》