DJ180
DJ180

Reputation: 19854

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?

Upvotes: 16

Views: 13396

Answers (6)

Nitin Kotwal.
Nitin Kotwal.

Reputation: 1

Check that the file is being opened in the Generic text editor.If not then, Right-click the file, choose Open With, and select Generic text Editor.

Upvotes: 0

Vinny Rao
Vinny Rao

Reputation: 1

OPEN YOUR FILE WITH GENERIC TEXT EDITOR

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

Upvotes: 0

vareste
vareste

Reputation: 445

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.

Upvotes: 0

Niko K
Niko K

Reputation: 31

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

Upvotes: 3

Dmytro Danylyk
Dmytro Danylyk

Reputation: 19788

Open eclipse and go to the following:

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

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

Upvotes: 1

E-Riz
E-Riz

Reputation: 32905

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.

Upvotes: 25

Related Questions