ADT eclipse xml layout text editor - often broken until file closed and reopened [duplicate]

依然范特西╮ 提交于 2020-01-02 00:13:53

问题


Possible Duplicate:
Moving and vanishing lines of code; trouble with Eclipse's XML Editor

I'm new to Eclipse and ADT but have set up my environment on two different machines, and both are displaying the same oddities (both are Windows 7 64 bit).

When changing tabs between the graphical layout and the main.xml views, the lines of code in the main.xml view will start disappearing or moving around. It's hard to display this without a video or animated gif, but I'll attempt with these screenshots:

Note that all I've done is highlight a block of text, and suddenly all these artifacts shwo up. It makes development a bit less than pleasant.

Any thoughts? Please Help me to solve this problem.

images :


回答1:


FOUND AN EASY WAY TO DISABLE THE BUG!! (WORKAROUND)

Window > Preferences > Android > Editors > Untick "Format XML files using the standard..." (1st option)

Then, just do Ctrl + Shift + F to Auto-format your XML to Eclipse Built-In convention. You should not be getting the bug at all.




回答2:


I had this problem my self, when the xml editor does this "thing" go to source->cleanup document, I kept the checkboxes on the dialog at their default (all checked except "convert line delimiters to...") and press ok.

that solved it for me. hope it helps.




回答3:


I had the same problem. What I did was deleted Eclipse and ADT. Then upgraded to Juno. The new combination seemd to fix it for me. I think its a problem with the new ADT and Indigo.




回答4:


I also had same problem and I think closing the file and opening it after clean again is the only solution.

I have found that this problem is only with Eclipse Indigo.




回答5:


Working solution for me is to convert line delimiters to Unix (LF, \n, 0A) for the xml layout file. (File > Convert Line Del. To > Unix) This need to be done only once. I didn't change default line ending in settings.

The ADT is not messing up the code any longer, and while editing xml manually, eclipse is smart enough to use Unix new line character for this file even if I have windows new line character set as default.

Origin of the problem:

The problem was that ADT inserted wrong new line characters. Eg. there was "\r\n\r\r\n" between the lines of code. Notice the double \r character.

When using Unix new line char (\r) only, as line delimiter, ADT is working properly. I also noticed better performance while working in "Graphical layout", and there are no extra unnecessary empty lines between xml elements.

So I guess there is bug in both ADT and Eclipse, ADT is inseting wrong line endings and Eclipse freaks out because of that.




回答6:


One thing that sometimes works for me is to do Ctrl+A, Ctrl+C, Ctrl+V. Basically, select all, copy, and paste. It sounds strange, but it usually fixes the problem without having to do anything particularly time consuming.




回答7:


It looks like an issue of Android or Eclipse ADT...see below links...

http://code.google.com/p/android/issues/detail?id=30529

https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421

for solve this problem update your ADT to letest version.



来源:https://stackoverflow.com/questions/10826791/adt-eclipse-xml-layout-text-editor-often-broken-until-file-closed-and-reopened

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!