Auto-formatting Android XML files in Eclipse

September 18, 2010

1) Open up Window->Preferences->XML->XML Files->Editor

Eclipse Preferences Dialog

2) Check the “Split multiple attributes each on a new line” and adjust other options according to your liking (such as Indent using spaces and Indentation size)

3) Press OK to save the options

Now, all you have to do is press Ctrl-Shift-F or select Source->Format to produce a more readable and enjoyable programming experience like this:

Android XML file


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: