LayoutFormatter
Better format your Android layout XML files.
It will adjust your attributes orders in accordance with the rules, and it will adjust some attributes to the front, and take some attributes at the end of the rows. It will make your code format more nice.
Related article: 《当我们谈 XML 布局文件代码的优雅性》

Obtaining & Installation
The plugin is distributed through the Plugin Manager in IntelliJ. https://plugins.jetbrains.com/plugin/8299
Search word
LayoutFormatter: On Mac:Preference -> Plugins -> Browse repositoriesOr you can download the jar file from LayoutFormatter.jar, then
Preferences -> Plugin -> Install plugin from disk...
Usage
YourFiles -> PopupMenu(Right Click) -> Refactor -> Reformat Layout XML.
Or you could use the default keyboard-shortcut: ctrl alt F (command alt F).
Changelog
v1.2.0
- Supported all of attrs of
ConstraintLayout - Supplied some attrs of
aligns
v1.1.5
- Revert
android:singleLine="true"issue;
v1.1.2
- Support Windows system;
- Fix the
/><bug.
v1.1.1
- Adjust the location of the Action to RefactoringMenu;
- Support UNDO(ctrl/command + z);
- Filter non XML file;
- Support one key to format all files on the entire project or folder;
- Add default keyboard-shortcut: ctrl alt F (command alt F).
v1.0.4
- Fix the bad style that
>or/>may be moved to a newline; - Add
fill_parenttomatch_parent; - Add
diptodp.
Note
Android Studio also has the same XML formatter:
Editor -> Code Style -> XML -> Arrangement, however I still think this plugin is more powerful, and easier to use.
