Search code examples
androidxmlandroid-layoutxamarinxamarin-studio

Xamarin Main.xml is missing from assets then Layout contains malformed xml - Root element is missing


I am starting out with Xamarin studio, I have build most basic forms project. In tutorials it shows how to edit layout in Main.xml, that is supposed to be in Resources/layout that is missing in my solution. So when I add it manually it then fails with error message The layout contains malformed XML and another one Root element is missing. When I opened the Main.xml in notepad I can see contents to be <?xml version="1.0" encoding="UTF-8" ?>.

enter image description here

How do contents of proper blank Main.xml supposed to be like?


Solution

  • Figured it out myself

    Click on source, then add

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent">

    and that should do it.

    enter image description here