Most of the people who work with Xamarin’s Mono for Android in Visual Studio 2012 face a bug where Intellisense doesn’t work for AXML in source view.
One of the fix which worked for me is mentioned below.
- Launch Visual Studio 2012
- Open a solution with .AXML file in it
- Now XML main menu should be visible on top
- Open “Schemas…” menu
- Sort by “File Name” column and see if “android-layout-xml” and “schemas.android.com.apk.res.android” are there. If found, skip to step 13
- If not found, go to “Program Files” if 32-bit system or “Program Files (x86)” if 64-bit system.
- Then go to “\MSBuild\Novell” or “\MSBuild\Xamarin\Android”
- You should be able to see 2 files “android-layout-xml.xsd” and “schemas.android.com.apk.res.android.xsd”
- Copy these 2 files to “\Microsoft Visual Studio 11.0\Xml\Schemas”
- Again open the “Schemas…” menu as mentioned in steps 3&4
- Now click “Add…” button and add these 2 files which should be located as mentioned in step 7 & 8
- Now restart visual studio and the XML editor for design layout should work fine with Intellisense
- From step 5….
- If above steps don’t work, then close the Visual Studio 2012.
- Now open “Developer command prompt for VS2012″ under Windows programs menu.
- Type “Devenv /ResetSettings” without quotes.
- Launch Visual Studio 2012 and see if Intellisense works.
- If still not working, better go to Xamarin forums and post there.
注意:visual studio安装目录下会有一个 monodroidcatalog.xml文件,是好改成下面一样:[本人是64位,32位没有(86)]
<SchemaCatalog xmlns="http://schemas.microsoft.com/xsd/catalog">
<Schema href="%ProgramFiles(x86)%/MSBuild/Xamarin/Android/android-layout-xml.xsd" targetNamespace="http://schemas.android.com/apk/res/android" />
<Schema href="%ProgramFiles(x86)%/MSBuild/Xamarin/Android/schemas.android.com.apk.res.android.xsd" targetNamespace="http://schemas.android.com/apk/res/android" />
<Association extension="axml" schema="%ProgramFiles(x86)%/MSBuild/Xamarin/Android/android-layout-xml.xsd" />
</SchemaCatalog>
红色标记部分是我手动加上去的。保存此文件后本人重启vs,然后新建一个.axml文件后可爱智能提示就出来了。。