Search code examples
android-studioandroid-studio-2.0

Sudden lag spikes when editing .xml layout files


When I'm editing XML files in Android Studio, for some reason it lags when scrolling, typing or anything else. For comparison, editing .java files isn't a problem.

Any ideas on how I can prevent these sudden spikes? They are really annoying when it takes 30 seconds to scroll through a 500 line .xml file, but only 10 seconds on a twice as big java file... My point, is there any way to stabilize this?

If it's relevant, I am using Android Studio 2.0.0


To clarify, I'm talking about the XML file's source code not the rendered output.


Solution

  • In case anyone else encounters this in the future, I've found that if you click on the little man with the hat at the bottom right, enable "Power Saving Mode" and switch down Highlighting level to "None", it reduces the XML editing lag in complex layouts.

    Once you make the edit, you can disable Power Saving and slide highlighting back up to see the changes in Preview.

    Not ideal, but it prevents the constant pauses between keypresses whilst editing.