简体   繁体   English

Xamarin.Android - 布局设计师空白

[英]Xamarin.Android - layout designer blank

Today I opened a project to find that none of its layouts will render in the designer. 今天我打开了一个项目,发现它的布局都不会在设计器中呈现。

在此输入图像描述

I am pretty sure it is not an issue with my AXML as the app works fine when built. 我很确定这不是我的AXML的问题,因为应用程序在构建时工作正常。 Visual Studio is up to date (15.9.9) and will display layouts in other projects without issue. Visual Studio是最新的(15.9.9)并将在其他项目中显示布局而不会出现问题。 My layouts are in the correct location (Resources/layout). 我的布局位于正确的位置(资源/布局)。 I have tried - 我努力了 -

  • Cleaning and rebuilding 清洁和重建
  • Deleting the bin/obj folders manually and rebuilding the project 手动删除bin / obj文件夹并重建项目
  • Turning Accelerated Rendering on/off in Options/Xamarin/Android UI Designer 在Options / Xamarin / Android UI Designer中打开/关闭加速渲染
  • Opening the project in Visual Studio for Mac (7.8) - same issue 在Visual Studio for Mac中打开项目(7.8) - 同样的问题
  • Restarting Visual Studio/rebooting my computer 重新启动Visual Studio /重新启动计算机

Any ideas on how to fix this would be greatly appreciated. 如何解决这个问题的任何想法将不胜感激。 I am not sure what part of the source would be useful to help with answering this question so please ask and I will provide. 我不确定该来源的哪一部分可以帮助回答这个问题所以请问我会提供。

Note - this project is on TFS. 注意 - 此项目在TFS上。

I have often run into this problem as well. 我经常遇到这个问题。 Unfortunately, I have not found an easy fix to this problem other than restarting all instances of Visual Studio (and Android Studio if you have that running as well) followed by a full restart of my computer. 不幸的是,除了重新启动Visual Studio的所有实例(如果你还运行了Android Studio的实例),然后重新启动我的计算机,我还没有找到解决这个问题的简单方法。 Hopefully this help, good luck. 希望这有帮助,祝你好运。

I found that the issue was caused by the target framework version of the app being set to Android 9.0. 我发现问题是由设置为Android 9.0的应用程序的目标框架版本引起的。 Setting this to 8.0 to match the version used by the designer fixed the issue. 将此值设置为8.0以匹配设计者使用的版本来解决问题。

在此输入图像描述

I need the target framework to be version 9.0 and I can't figure out how to add versions to the designer (8.0 is the only one available to me). 我需要目标框架为9.0版本,我无法弄清楚如何向设计器添加版本(8.0是我唯一可用的版本)。 I have asked another question in regards to this ( see here ). 我问过另一个问题( 见这里 )。

This happened to mine and a colleague's Visual Studio a while ago, it was working then it was blank. 这发生在我和同事的Visual Studio之前,它正在工作然后它是空白的。 We tried changing the target framework but couldn't get it working, I even completely reinstalled VS. 我们尝试更改目标框架但无法使其正常工作,我甚至完全重新安装了VS.

In our cases turning off "Enable Accelerated Rendering" in Tools > Options > Xamarin > Android UI Designer worked and we can now see the app as we build it. 在我们的工具>选项> Xamarin> Android UI Designer中关闭“启用加速渲染”的情况下,我们现在可以在构建时看到应用程序。 We didn't change the setting so assume it's the default, which makes me think it was caused by a VS update. 我们没有更改设置,所以假设它是默认设置,这让我觉得它是由VS更新引起的。

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

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