Android XML editors broken in Eclipse

2019-08-10 22:58发布

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! **

2条回答
贼婆χ
2楼-- · 2019-08-10 23:29

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

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-08-10 23:29

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.

查看更多
登录 后发表回答