softwaresupply
softwaresupply

Reputation: 1948

Eclipse inserts a new line in android xml files

I have an Android xml file which contains something like:

    <!-- foto with border -->

    <LinearLayout
        android:id="@+id/ll_border_black"
        android:padding="1dp" >

When I remove the blank line between the comment and the LinearLayout and then I do code formatting by Strg + Shift + F or Strg + I the empty line gets inserted again. I tried to fix this by Settings -> XML -> XML Files -> Editor by new settings like "Split multiple attributes each on a new line". I had no success.

Upvotes: 1

Views: 1517

Answers (4)

matteo.cajani
matteo.cajani

Reputation: 2655

If you're using android xml editor check: Window > Preferences > Android > Editors > Always remove empty lines between elements

Upvotes: 1

Tor Norbye
Tor Norbye

Reputation: 9150

By default, XML files in Android project will use a custom XML formatter intended for XML files (so it for example has different policies for whether attributes appear on separate lines and blank lines between elements depending on which type of resource file you're editing -- values, layouts, manifests, etc.)

You can edit these preferences under Preferences > Android > Editors.

If you want to use the default XML editor instead (which uses the settings path pointed to by others in this thread) you can also go to that preference page and turn off the custom formatter.

Upvotes: 3

nitind
nitind

Reputation: 20003

The Android layout editor has its own formatter. Perhaps it has its own preference page?

Upvotes: 0

Riddhish.Chaudhari
Riddhish.Chaudhari

Reputation: 853

set enable

Window -> Preference -> XML Files ->Editor ->Clear all blank lines

And than use code formatting

Upvotes: 0

Related Questions