Android XML IntelliSense

Many of the Android resources, from layouts and styles to animations and even manifests are defined in XML. The XML spec for all of these different resources is a bit dynamic and varies based on things outside the XML document. For these and other reasons there is no official schema provided by Google to define the XML document, as would be needed for Visual Studio to provide IntelliSense for these XML files.

The “June 2012” release of Oxygene for Java changes all that. We’ve generated 4 schema files that provide IntelliSense for pretty much all the Android XML resources you may encounter. The IntelliSense provides elements and attributes, and in a few cases values for everything from Layouts to Manifests.

Because of the way the XML IntelliSense works in Visual Studio, and because the Android XML doesn’t completely implement the schema as it should, we had to rename the XML files to make them work with the schemas and provide IntelliSense. So to get all the Android IntelliSense goodness, you need to rename your XML layouts to .layout-xml and every other XML document to .android-xml. All of the examples and templates are updated with this new naming.

Android Solution Explorer

Since there is no official schema, and the XML specification in the Android documentation is a little vague in places, we are looking for your feedback how better to improve the IntelliSense. An important area you will notice is with user defined widgets in the layouts. Currently, the IntelliSense schemas are static, so if you add a new widget, it won’t show up in the IntelliSense. Let us know if you run into any other situations where the IntelliSense could be a little more intelligent.

Also, to make the IntelliSense even more helpful, we added a range of new item templates to Android projects. They all get put into the correct folder as required by the Android spec. For Drawables, it puts them in the default /res/drawable folder. From there you can move them to a drawable folder for a specific DPI.

Add New Android Templates

Likewise, if you come across any other Android templates that should be included to make your life easier, please let us know.

jim

0