问题描述
我有一个MasterDetailPage,并且此页面被推送到导航:
I have a MasterDetailPage and this page get pushed to a Navigation:
await MainPage.Navigation.PushAsync(new MasterDevicePage());
当加载主设备页面时,主页面的列表视图将选择页面之一并将其显示在详细信息屏幕上.
when the master device page get loaded, the master page's list view will then select one of the page and display it on the detail screen.
masterPage.ListView.ItemSelected += (sender, e) =>
{
var item = e.SelectedItem as MasterPageModel;
if (item != null)
{
Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
Detail.Title = item.Title;
masterPage.ListView.SelectedItem = null;
IsPresented = false;
}
};
该错误发生在细节=新的NavigationPage"部分.
The error occurs at the Detail = new NavigationPage part.
无法激活类型的实例 Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer来自 本地句柄0x85300019(key_handle 0x42c360f8).
Unable to activate instance of type Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer from native handle 0x85300019 (key_handle 0x42c360f8).
推荐答案
您可以尝试修复提供构造函数的
You can try to fix it supplying constructor
public YourClass (IntPtr javaReference, JniHandleOwnership transfer)
: base ()
{
}
但是永远不要将MasterDetailPage推送到导航堆栈.
BUTMasterDetailPage should be never pushed to Navigation stack.
这篇关于无法激活类型NavigationPageRenderer的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!