1

Until today (I have no idea what I did to cause this), if I double-clicked an android XML file, then the correct editor would appear.

For example, double-clicking a layout file would open a Graphical Layout tab and a tab with the XML contents for direct editing (named as the file being edited). Now all I get is a Design and a Source tab!

I am unable to preview the layouts I am editing (this is the same as here: Graphical Layout tab does not appear for some layout files into Eclipse)

That link also gives a 'workaround' in that I can right-click the file and open with the right editor, but this isn't a solution!

How can I sort this permenantly? I have re-installed fresh Eclipse, ADT to no avail (haven't used fresh SDK... will that matter??).

** Note this happens to all Android XML files, not just layout ones I mentioned above! **

Community
  • 1
  • 1
neildeadman
  • 3,974
  • 13
  • 42
  • 55
  • I hadn't checked the AndroidManifest.xml file, but this opens correctly! :S – neildeadman Nov 16 '11 at 12:58
  • refer to this http://stackoverflow.com/questions/7966734/how-to-opening-layout-xml-files-in-android-layout-editor – Padma Kumar Nov 16 '11 at 12:59
  • All applicable Android Editors are present in the 'Associated Editors' list for *.xml. The non-Android ones say they are locked. Do I need to make one a default? Will this not then cause other Android XML files to also open with the same default editor (i.e. menu.xml opening with layout editor)? – neildeadman Nov 16 '11 at 13:03
  • It appears that Eclipse 'remembers' what I opened the file with so next time (having done the right-click thing) it opens correctly... a pain to have to go through all files though! – neildeadman Nov 16 '11 at 13:24
  • And they show the file with X in it icon rather than the correct Android file icon.... – neildeadman Nov 16 '11 at 13:27

2 Answers2

4

Yes this may be a permanent solution:

  1. Select any XML layout file
  2. click on Window->Preferences menu.
  3. Follow steps as mentioned in attached image.

enter image description here

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
  • 1
    What is the final step?? To lick default? Will this not make all Android XML files open with the Android Layout Editor (such as menu XML files)? – neildeadman Nov 16 '11 at 13:05
0

What I had to end up doing was selecting the Legacy Android Xml Resources Editor from the same list that Paresh is showing and setting it as the default. I had to choose it from the list that appears when you click the add button. After that I restarted eclipse and everything was fine.

DroidT
  • 3,168
  • 3
  • 31
  • 29