Tag: xamarin.android

TextInputEditText:ArgumentNullException:MvxWeakEventSubscription中缺少源事件信息

突然,我的TextInputEditText的绑定开始失败,并且它与链接器有关。 如果我将链接器设置为“无”,则一切都按预期工作。 我使用的很多其他绑定仍然可以正常工作。 堆栈我得到: 视图绑定期间抛出的exceptionArgumentNullException:MvxWeakEventSubscription中缺少源事件信息参数名称:MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription 2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler sourceEventInfo 2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler 1 [TEventArgs] targetEventHandler)[0x00017]在D:\ git \ MvvmCross \ MvvmCross \ Platform \ Platform \ WeakSubscription \ MvxWeakEventSubscription.cs:47 at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription 2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.String sourceEventName, System.EventHandler 1 [TEventArgs] targetEventHandler)[0x00000]位于MvvmCross.Platform的D:\ git \ MvvmCross \ MvvmCross \ Platform \ Platform \ […]

MvvmCross vnext:将插件与monodroid合并

我正在尝试将插件库项目合并为一个(例如,Location + PhoneCallTask​​)。 它与wp7完美配合,但我得到monodroid的未处理exception: 无法加载文件或程序集’Cirrious.MvvmCross.Plugins.Location.Droid.dll’ 当然,位置插件在’Cirrious.MvvmCross.Plugins.Droid.dll’(合并库)中引用。 有没有办法指向合并的库路径?

如何从Xamarin Forms for Android中的按钮视图中删除额外的填充?

Xamarin Forms上的按钮视图似乎在部署到Android时会应用额外的填充。 我在我的Android项目下设置了Resources / values / styles.xml,默认情况下所有间距,填充和边距都为0,但仍然应用了额外的填充: 0.0px 0.0 0.0px 0.0px 0.0px 请看下面的比较,看看我在说什么(左边是iOS,右边是Android)。 请注意iOS中的视图如何相互冲洗(应该如此),而Android中存在不必要的额外空白。 显示器由绝对和堆叠布局,几个按钮和一个标签(长标签)组合而成。 在iOS示例中,不要担心没有大小和排列的东西; 这是故意的。 iOS显示器正是我希望它们看起来的样子。 理想情况下,我想要一个Android风格或一个简单的“一刀切”的代码片段,我可以使用它来摆脱Android的固定间距。 边距,间距和填充在两个设备上以相同的方式以编程方式设置,因此不应该是问题的根源。 请注意,我正在使用C#和Xamarin Forms – 而不是XAML。 因此,请提供适用于两者的答案,或至少从纯粹的程序化Xamarin表单实现开始。 这是另一个例子(左边是iOS,右边是Android)。 最外面的布局是一个网格,包含六个非布局视图(两个按钮,两个标签和两个条目)以及底部的堆栈布局(同样包含一个按钮,一个标签和一个条目)。 你可以从颜色的差异看出一切都正确排列,除了按钮。 仅使用视图边距设置对齐; 默认间距和填充都被清零(从Android风格,见上文)。

FormsViewGroup.dll(v7.1)的$(TargetFrameworkVersion)大于项目的$(TargetFrameworkVersion)(v6.0)xamarin

错误出现在visual studio 2017和xamarin上: 严重性代码描述项目文件行抑制状态 警告FormsViewGroup.dll(v7.1)的$(TargetFrameworkVersion)大于项目的$(TargetFrameworkVersion)(v6.0)。 您需要为项目增加$(TargetFrameworkVersion)。 IpiCommunicationXamarin.Android D:\ XmarainTest \ IpiCommunicationXamarin \ IpiCommunicationXamarin \ IpiCommunicationXamarin.Android \ IpiCommunicationXamarin.Android.csproj

如何修复Xamarin.forms System.IO.FileNotFoundException:找不到文件

我正在使用xamrin.forms ,我正在尝试访问文件并阅读它。 我有lastusername.txt作为文本文件,我将它的构建操作设置为“内容”,实际上我正在尝试读取文件如下: var filename = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), “lastusername.txt”); if (filename != null) return System.IO.File.ReadAllText(filename);//error occurred here else return “”; 我收到以下错误: System.IO.FileNotFoundException:找不到文件

MonoDroid:Encoding.ASCII.GetString失败

间歇性地,Encoding.ASCII.GetString调用失败,exception会转义所有catch块并冻结应用程序。 private string ExecuteRequest(Uri url, KeyValuePair[] postItems = null) { var data = new byte[0]; var response = new byte[0]; using (var client = new WebClient()) { if (postItems != null && postItems.Count() > 0) { string dataString = string.Join(“&”, postItems.Select( item => string.Format(“{0}={1}”, item.Key, item.Value)).ToArray()); data = new ASCIIEncoding().GetBytes(dataString); } response = client.UploadData(url, “POST”, […]

为什么IAsyncResult将所有端口报告为已打开?

我有一个在线程中运行的方法,但是当我测试它时报告所有端口都是打开的。 似乎方法: var result = client.BeginConnect(host, port, null, null); 在var success = result.AsyncWaitHandle.WaitOne(tcpTimeout);传递结果时效果var success = result.AsyncWaitHandle.WaitOne(tcpTimeout); … 知道如何解决这个问题吗? 我试过client.ConnectAsync(host,port).Wait(TcpTimeout); 但这也没有按预期工作…. public void start() { Thread thread1 = new Thread(new ThreadStart(RunScanTcp)); thread1.IsBackground = true; thread1.Name = “THREAD ME EMER : ” + i; thread1.Priority = System.Threading.ThreadPriority.Highest; thread1.Start(); } public void RunScanTcp() { while (((port = portList.NextPort()) […]

安排警报管理器每周四运行一个方法

例如,我希望每周四中午12点发出警报我该怎么做? 我有一些实施,但没有正常工作,我的代码,今天是星期三15,如果将手机的日期更改为16星期四,该应用程序没有做任何事情,如果我在下周三更改手机的日期22电话发送通知,但只应在星期四发送。 这是我的代码: 主要活动: protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); AsNumAssemblyHelper.HoldAssembly(); global::Xamarin.Forms.Forms.Init(this, bundle); ImageCircleRenderer.Init(); Intent alarmIntent = new Intent(this, typeof(AlarmReceiver)); PendingIntent pending = PendingIntent.GetBroadcast(this, 0, alarmIntent, PendingIntentFlags.UpdateCurrent); AlarmManager alarmManager = GetSystemService(AlarmService).JavaCast(); //AlarmType.RtcWakeup – it will fire up the pending intent at a specified time, waking up the device […]

从android_assets文件夹动态加载dll

当它在资产文件夹中时,是否可以使用Assembly.Load加载一个dll? 我有windows和android平台特定的dll。 我尝试使用android特定的dll作为资产(也在构建操作中),但是当我尝试将其加载到我的应用程序时,它找不到(我使用了path: file:///android_asset/mydll.dll ),并且这只会发生,如果我构建应用程序作为发布,在调试中我获得加载库的必要路径,但不是从资源文件夹。 我能做什么? 还有另一个地方,我可以从我的应用程序加载我的DLL吗?

如何使用xamrian表单提示用户进行地理定位

您好我正在使用xamrian表单应用程序中的应用程序,需要请求gelocation权限,如果授权它需要从设备获取地理位置数据,然后将地理位置坐标放入forecast.io URL我正在使用Geolocator插件詹姆斯·蒙特马尼奥以及詹姆斯·蒙特马尼奥的PermissionsPlugin,当我打开雷达页面时,屏幕保持白色,它永远不会要求我的许可,这是我的xamrain表单代码: using AppName.Data; using Xamarin.Forms; using Plugin.Geolocator; using System.Diagnostics; using System.Threading.Tasks; using Plugin.Permissions; using Plugin.Permissions.Abstractions; using System; namespace AppName.Radar { public partial class RadarHome : ContentPage { public RadarHome() { InitializeComponent(); } async void locator() { try { var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location); if (status != PermissionStatus.Granted) { if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Permission.Location)) { await DisplayAlert(“Need […]