Xamarin.Android - layout designer blank

2019-07-25 10:40发布

Today I opened a project to find that none of its layouts will render in the designer.

enter image description here

I am pretty sure it is not an issue with my AXML as the app works fine when built. Visual Studio is up to date (15.9.9) and will display layouts in other projects without issue. 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
  • Turning Accelerated Rendering on/off in Options/Xamarin/Android UI Designer
  • Opening the project in Visual Studio for Mac (7.8) - same issue
  • Restarting Visual Studio/rebooting my computer

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.

3条回答
何必那么认真
2楼-- · 2019-07-25 11:15

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. Hopefully this help, good luck.

查看更多
Bombasti
3楼-- · 2019-07-25 11:17

This happened to mine and a colleague's Visual Studio a while ago, it was working then it was blank. We tried changing the target framework but couldn't get it working, I even completely reinstalled 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. We didn't change the setting so assume it's the default, which makes me think it was caused by a VS update.

查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-07-25 11:21

I found that the issue was caused by the target framework version of the app being set to Android 9.0. Setting this to 8.0 to match the version used by the designer fixed the issue.

enter image description here

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). I have asked another question in regards to this (see here).

查看更多
登录 后发表回答