来自支持设计库的控件未在布局设计器预览中显示。
“显示错误”按钮不执行任何操作
这是我的axml来源
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
来自xamarin logfile的一些例外
System.NullReferenceException: Object reference not set to an instance of an object. at Xamarin.AndroidDesigner.VisualItems.ExceptionCalloutButton.CreateExceptionPopoverContent() in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\MonoDevelop.MonoDroid\Xamarin.AndroidDesigner\Xamarin.AndroidDesigner.VisualItems\ExceptionCalloutButton.cs:line 55 at Xamarin.AndroidDesigner.VisualItems.ExceptionCalloutButton.ShowExceptionPopover() in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\MonoDevelop.MonoDroid\Xamarin.AndroidDesigner\Xamarin.AndroidDesigner.VisualItems\ExceptionCalloutButton.cs:line 45 at Xamarin.AndroidDesigner.VisualItems.ExceptionCalloutButton.OnShowErrorButtonClicked(Object sender, EventArgs e) in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\MonoDevelop.MonoDroid\Xamarin.AndroidDesigner\Xamarin.AndroidDesigner.VisualItems\ExceptionCalloutButton.cs:line 32 at Xamarin.Designer.VisualItem.OnClicked() in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\Xamarin.Designer\Xamarin.Designer\VisualItem.cs:line 692 at Xamarin.Designer.VisualItems.ButtonItem.OnClicked() in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\Xamarin.Designer\Xamarin.Designer.VisualItems\ButtonItem.cs:line 84 at Xamarin.Designer.VisualItem.OnButtonReleased(ButtonEventArgs args) in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\Xamarin.Designer\Xamarin.Designer\VisualItem.cs:line 674 at Xamarin.Designer.DesignerSurface.ReleaseButtonOnItem(VisualItem vi, ButtonEventArgs args) in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\Xamarin.Designer\Xamarin.Designer\DesignerSurface.cs:line 590 at Xamarin.Designer.DesignerSurface.OnButtonReleased(ButtonEventArgs args) in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\Xamarin.Designer\Xamarin.Designer\DesignerSurface.cs:line 609 at Xamarin.Designer.DesignerSurface.ButtonReleased(ButtonEventArgs args) in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\Xamarin.Designer\Xamarin.Designer\DesignerSurface.cs:line 571 at Xamarin.Designer.Windows.EventUtils.ForwardButtonEvent(Action1 action, Object sender, MouseButtonEventArgs e) in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\Xamarin.Designer\Xamarin.Designer.Windows\EventUtils.cs:line 22
at Xamarin.Designer.Windows.WpfSurfaceRenderer.<>c__DisplayClass79_0.b__4(Object sender, MouseButtonEventArgs e) in C:\d\lanes\4471\3f99c5a7\source\xamarinvs\External\md-addins\Xamarin.Designer\Xamarin.Designer.Windows\WpfSurfaceRenderer.cs:line 586
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
更新:我添加了来自nuget
的所有支持设计库包答案 0 :(得分:0)
我找到了解决方案。问题是只有在布局设计器窗口中选择了appcompat主题时才能呈现支持控件。