简体   繁体   English

Xamarin Android | 用户界面在设备中显示为空白

[英]Xamarin Android | UI shows up blank in device

I'm developing android app for learning purpose. 我正在开发用于学习目的的android应用。 I've installed Xamarin 4.2.1.60 on my laptop. 我已经在笔记本电脑上安装了Xamarin 4.2.1.60 I created a simple Layout and tried to run it on my One Plus 3 (Android M 6.0.1) and Moto G (Android L 5.1) 1st Gen but the layout shows up empty in both of them. 我创建了一个简单的布局,并试图在我的One Plus 3(Android M 6.0.1)Moto G(Android L 5.1)1st Gen上运行,但是两个布局均显示为空白。 It also gives me a below Exception on running: 它还在运行时给了我以下异常:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. 未处理的异常:System.NullReferenceException:对象引用未设置为对象的实例。

On pressing break, a window open in Visual Studio with Header saying Source Not Available (Please see attached screenshots) 在按下break时,将在Visual Studio中打开一个带有标题为Source Not Available的窗口(请参阅所附的屏幕截图)

Please suggest how can I resolve this. 请提出我该如何解决。

Designer Screen: 设计器屏幕:

设计器屏幕

Device Screen: 设备屏幕:

设备屏幕

Exception Window: 例外窗口: 例外窗口

确保在MainActivity.OnCreate()使用有效的Android布局设置默认的SetContentView()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM