Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij IDEA formatting XML with aligning attributes

Is there any chance to format XML files, and some code like this:

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:longClickable="false"
    >

to be like this?

<RelativeLayout
    android:layout_width  = "fill_parent"
    android:layout_height = "wrap_content"
    android:orientation   = "horizontal"
    android:longClickable = "false"
    >

enter image description here


I've tried the space around "=" option, but that's not what I want.

like image 916
Omid Avatar asked Dec 04 '13 10:12

Omid


People also ask

How can I beautify code in IntelliJ?

Sometimes code formatting can get out of sync, but there's an easy fix in IntelliJ IDEA. You can use ⌘⌥L (macOS), or Ctrl+Alt+L (Windows/Linux) to reformat a selection of code according to your reformat settings.

How do I correct indentation in IntelliJ?

Press Ctrl+Alt+S to open the IDE settings and select Editor | Code Style. Select the Detect and use existing file indents for editing checkbox.

How do I enable auto format in IntelliJ?

Automatically formatting code in Android Studio and IntelliJInstall the Dart plugin (see Editor setup) to get automatic formatting of code in Android Studio and IntelliJ. To automatically format your code in the current source code window, use Cmd+Alt+L (on Mac) or Ctrl+Alt+L (on Windows and Linux).


1 Answers

Unfortunately this is not possible. I've always thought that this is something that would be useful. Your question prompted me to opened a feature request for it: IDEA-117587: XML - Align attribute values Please consider voting for it.

like image 150
Javaru Avatar answered Oct 05 '22 10:10

Javaru