Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Android XML jumps around the editor

I have been coping with an annoying "bug" in eclipse (android) for some time, and today it has just annoyed me to much! So I was wondering has anyone else come accross it, and have you found a fix for it?

It's hard to explain, so hopefully these three screen caps will help:

The first screenshot, everything is ok.

Screen 1 - Everything is ok

The second screenshot, after a simple click everything moves around.

Screen 2 - A simple click, notice how lines have duplicated and moved

The third screenshot, another click and things move again.

Screen 3 - Another click, things move again

Closing the file and opening it again seams to solve the problem for a while, but it's really annoying!

Has anyone come across this, or a fix for it?

--EDIT

Forgot to mention, I am running:

  • Eclipse 4.2.0 64-Bit (on Windows 7)
  • ADT 20
like image 590
melodiouscode Avatar asked Sep 02 '12 11:09

melodiouscode


1 Answers

This is a known bug and happens if you edit the layout in the visual editor and then switch back to the xml editor. You can sometimes fix it by scrolling up and down the file or selecting all the text. Otherwise, just close and reopen the xml file when switching from visual editor to xml editor. It's annoying and still happens to me even after several updates to ADT.

Edit:

I have since found a better solution. In Eclipse go to Window->Preferences. Then under Android->Editors uncheck "Automatically format the XML edited by the visual layout editor". This should solve the problem. You can always auto-format the code manually by pressing Ctrl+Shift+F.

like image 158
Jimbali Avatar answered Sep 25 '22 10:09

Jimbali