16

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?

skolima
  • 31,963
  • 27
  • 115
  • 151
DJ180
  • 18,724
  • 21
  • 66
  • 117

6 Answers6

25

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.

E-Riz
  • 31,431
  • 9
  • 97
  • 134
  • 3
    Or **Android Common XML Editor** if you don't have Layout http://store.picbg.net/pubpic/4F/14/47c21898788f4f14.png – Bonnev Jul 03 '14 at 17:55
3

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
Niko K
  • 31
  • 2
1

Open eclipse and go to the following:

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

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

Dmytro Danylyk
  • 19,684
  • 11
  • 62
  • 68
0

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.

Community
  • 1
  • 1
resw67
  • 139
  • 3
  • 6
0

OPEN YOUR FILE WITH GENERIC TEXT EDITOR

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

  • This does not answer the question. – PrashanD Mar 08 '22 at 14:05
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31240264) – Abhishek Dutt Mar 11 '22 at 03:40
0

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.