当我快速点击菜单项时,我的Xamarin.Forms应用程序崩溃了

时间:2017-01-25 05:25:36

标签: c# android xamarin xamarin.android xamarin.forms

我正在使用抽屉布局的主详细信息页面,当我快速点击母版页项目以导航到详细页面时,我的应用程序崩溃了。

错误是:

  

System.NotSupportedException:无法激活Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer类型的实例   本机句柄0xffd4ff7c(key_handle 0x9721379)。

MasterDetail页面背后的代码:

var ApplicationApprovalTap = new TapGestureRecognizer();
            ApplicationApprovalTap.Tapped += ApplicationApprovalTap_Tapped;
            masterPage.lblApplicationApproval_LABEL.GestureRecognizers.Add
            (ApplicationApprovalTap);

实施:

        private void ApplicationApprovalTap_Tapped(object sender, EventArgs e)
        {
            IsPresented = false;
            Detail = new NavigationPage((Page)Activator.CreateInstance(typeof(ApplicationApproval)));
            #region Change Color of Heder
            masterPage.lblApplicationStatus_LABEL.TextColor = Color.Black;
            #endregion
            #region Change color in current module
            masterPage.lblApplicationApproval_LABEL.TextColor = Color.FromHex("#f15a23");
            #endregion
            #region Change Color in other module
            masterPage.lblStatus_LABEL.TextColor = Color.Black;
            masterPage.lblApplication_LABEL.TextColor = Color.Black;
            #endregion
        }

导航到详细信息页面:

Detail = new NavigationPage((Page)Activator.CreateInstance(typeof(ApplicationApproval)));

我参考了以下链接:

https://forums.xamarin.com/discussion/10867/notsupportedexception-unable-to-activate-instance-of-type-activity

https://bugzilla.xamarin.com/show_bug.cgi?id=40258

但没有得到适当的解决方案。

0 个答案:

没有答案