Java – Android Studio code formats multiple files

Android Studio code formats multiple files… here is a solution to the problem.

Android Studio code formats multiple files


already know how to format Android Studio files manually, but is there any way to format the code, for example, if I close a tab. I created a macro that formats the code on save, but only on the currently viewed .java/.xml, and I need to do everything for the open/modified file (Git) or all project files.

Explanation: There are scenarios where when we have to manually override strings.xml outside of Android Studio, it can mess up the formatting, so the next person always has to open the xml and hit save.


If you select a package or directory in the Project View on the left, you can format multiple files at once. Simply select the range (e.g. project directory) and press Ctrl + Alt + L.

See also IntelliJ documentation

Related Problems and Solutions