Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 505
DJ180 Avatar asked Feb 02 '12 14:02

DJ180


2 Answers

Check that the file is being opened in the Android XML Layout editor (not just the "plain" XML editor). Right-click the file, choose Open With, and select Android Layout Editor.

like image 182
E-Riz Avatar answered Oct 11 '22 01:10

E-Riz


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
like image 3
Niko K Avatar answered Oct 11 '22 02:10

Niko K