When I write .xml files in Eclipse, I often have to manually indent code. For example
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/background" android:layout_height="fill_parent" android:layout_width="fill_parent" />
After formatting it looks like this.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@color/background" android:layout_height="fill_parent" android:layout_width="fill_parent" />
How to automate this? I can't find formatting settings in Eclipse for XML.
To format your whole script: Open the required file. Go to Source | Format Document or press Ctrl+Shift+F.
To access XML formatting options, choose Tools > Options > Text Editor > XML, and then choose Formatting.
Ctrl+Shift+F
Will do it for you, and you can configure it in
Window -> Preferences -> XML -> Xml Files -> Editor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With