简体   繁体   中英

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. 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.

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.

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.

在此输入图像描述

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 ).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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