Visual Studio 2022 Xamarin.Android Designer Displays Wrong Layout

Nathan Sokalski 4,111 Reputation points
2021-11-13T03:25:20.08+00:00

I recently started using Visual Studio 2022 for my Xamarin.Android apps (I haven't checked if the problem exists in Visual Studio 2019). I have several layouts in directories with qualifiers (layout, layout-h540dp-land, layout-land) for the appropriate scenarios. This works fine when debugging my app, but the Visual Studio 2022 Designer does not always display the correct layout. The correct code (the xml code) is displayed, so I can edit all the files, but the preview is not always correct. It sometimes displays the preview for one of the other layouts. I have also noticed that the specified device is different than the one in all my other layouts, and that if I change this to a different device, it just changes back after I select a different layout. These problems only happen for layouts that have multiple versions (versions in the directories with qualifiers). Why is the designer acting so strange? I would be satisfied opening the different versions in separate tabs if necessary, but opening any version of the file opens all of them in the multi-version editor. I do not need any of the Multi-edit or linking features (although it is nice to have the New Version button, but once it is created, I want to edit the file without Multi-edit or linking).

Developer technologies | Visual Studio | Debugging
Developer technologies | Visual Studio | Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.