问题
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! **
回答1:
Yes this may be a permanent solution:
- Select any XML layout file
- click on
Window->Preferences
menu. - Follow steps as mentioned in attached image.

回答2:
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.
来源:https://stackoverflow.com/questions/8152046/android-xml-editors-broken-in-eclipse