'Android: Eclipse autocomplete does not work in xml files

I am seeing a strange problem with my Eclipse IDE for Android development.

Autocompletion does not work when I hit Ctrl + Space in the main.xml file for my layouts. In the bottom left, I get a message saying for example "LinearLayout not found".

I also have the correct namespace specified in my file.

It does work though for other xml files, such as my strings.xml which I find strange.

This is an annoyance as I'd like to easily see all the options available for a View or Layout.

Anyone got any ideas on how to resolve this?



Solution 1:[1]

It seems like an eclipse XML editor issue. If you declare the xmlns in other than "xmlns:android" you loose the autocompletion.

for example if you say:

 xmlns:android="http://schemas.android.com/apk/res/android"
android:.... //AUTOCOMPLETES

if you say

 xmlns:android1="http://schemas.android.com/apk/res/android"
android1:... //DOES NOT AUTOCOMPLETE

Solution 2:[2]

Open eclipse and go to the following:

Window > preferences > XML > editor > content assist > advanced

Select all checkboxes and click ok. After that, restart eclipse.

Solution 3:[3]

Try this as suggested powder366

Or you can set the default editor in Eclipse Preferences, used Android Common XML Editor. You find it in Eclipse Preferences, General, Editors, File Associations. Click on .xml, choose "Add" "Android Common XML Editor". Select it and press the Default button.

Solution 4:[4]

OPEN YOUR FILE WITH GENERIC TEXT EDITOR

Right-click on XML File, select Open with GENERIC TEXT EDITOR

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Niko K
Solution 2
Solution 3 Community
Solution 4 Vinny Rao