Moving and vanishing lines of code; trouble with Eclipse's XML Editor
This bug is (finally) fixed in ADT 21. The fix is now available in ADT 21 Preview 9, posted a few minutes ago, here: https://android-review.googlesource.com/#/c/44936/1
The reason you get weird visual artifacts is that if a file contains broken DOS line endings (multiple carriage returns without a newline for each carriage return), Eclipse gets very confused. That's Eclipse issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421 .
There are two parts to the fix:
(1) First, ADT was fixed such that it no longer introduces these \r\r sequences into the document. This makes sure that you don't get new documents which triggers the weird editing behavior, but it does not retroactively fix older documents with these line endings, so if you open them, you still get weird editing behavior.
(2) Second, there's a new lint check which looks for broken line endings in documents. This runs incrementally, so if you edit an XML file which has this problem, ADT will add an error marker for this problem -- along with a quickfix to perform surgery on the document to fix it.
In short:
Get ADT 21 Preview 9; run Lint on your projects and look for any complaints about files containing broken line endings, and if it finds any, apply the quickfix. From now on, further edits with the layout editor should keep the files consistently formatted.
FYI, the relevant fix is here: https://android-review.googlesource.com/#/c/44936/
Instructions for easily updating SDK Tools and the Eclipse ADT plugin are here: http://tools.android.com/preview-channel
-- Tor
(from the Android tools team)
Eclipse Android XML jumps around the editor
As some commentators have mentioned it seems that this is a duplicate (have flagged as such), although as it is a hard issue to describe that is no surprise! I have tried an answer from one of the questions and it seems to solve the problem. Although it does not prevent the issue!
Problems with Android XML Editor and Eclipse...Hard to manually edit XML
This is fixed in ADT 20 Preview 3, released today.
http://tools.android.com/download/adt-20-preview
Eclipse errors while editing XML Layout file
This is the eclipse known error. Just close the file and reopen it again. It will work for you.
If this don't work then just restart the eclipse once.
Eclipse with Android layout's main.xml?
After some tests, I have found that the option "Automatically format the XML edited by the visual layout editor" (in Preferences | Android | Editors) might be the culprit here.
With my tests, I've found that changing a property (such as the layout_gravity) while in Graphical Layout design mode always screw up the visual display of the file when I go back to the XML (text) mode when this option is ON but that I have no problem when it's off.
If you want to format the XML upon your return from the Graphical Layout design mode, simply use the shortcut Ctrl-Shift-F. Also, I didn't see any problem with using the option "Format on Save"; even when I use it in the Graphical Layout mode; so you can use Ctrl-S instead while you're still in the Graphical Layout mode to both save and format your XML.
I've tried other editors options like "Show range indicator" or "Use characters to show changes in vertical ruler" but I didn't see any difference in behavior with activating or de-activating these options.
Finally, to correct the visual display of the file when it's corrupt; I found that using the shortcut: Ctrl-A, Ctrl-C, Ctrl-V is a little easier than closing/reopening the file. This is equivalent to making a Select All, Copy, Paste; effectively copying the whole XML file over itself.
How to highlight the recently edited lines on the right side of the editor
I think you are looking for the Quick Diff Feature:
Preferences -> General -> Editors -> Text Editors -> Quick Diff
Here you can set whether to show the quick diff in the left and/or right ruler, what colors to use, and what base version to diff against, e.g. since last save, or different types of version control.
If you are using version control, such as GIT or SVN, you can have a similar effect by selecting Team -> Show Annotations from the context menu.
Related Topics
Play Sound on Button Click Android
Creating Viewholders for Listviews with Different Item Layouts
How to Know That My Webview Is Loaded 100%
How to Align Title at Center of Actionbar in Default Theme(Theme.Holo.Light)
How to Delete SQLite Database from Android Programmatically
No Good Example About Recyclerview and Staggeredgridlayoutmanager in Android Docs
How to Set a Viewpager Inside a Fragment
Listen Outgoing Sms or Sent Box in Android
Change the Font of Tab Text in Android Design Support Tablayout
Android Studio:Unmappable Character for Encoding Utf-8
Android Contacts Display Name and Phone Number(S) in Single Database Query
How to Set "Android:Layout_Below" at Runtime Programmatically
Cannot Resolve Symbol 'Theme' in Styles.Xml (Android Studio)
Accessing UI Thread Handler from a Service
How to Get Contacts' Phone Number in Android
Upload an Image from Camera or Gallery in Webview
How to Disable/Enable Dialog Negative Positive Buttons
How to Implement Draggable Map Like Uber Android, Update with Change Location