After updating to Android Studio 3.2.1 the XML files format is very annoying and bad, how can we fix it? Can we change it from somewhere in settings to previews type?
Asked
Active
Viewed 5,589 times
17
3 Answers
27
On Android Studio 3, Go to :
Preferences > Editor > Code style > XML then on Scheme switch to Default instead of Project.
You can then use those shortcuts to indent your code:
Windows:
Ctrl + Alt + L
macOS:
Option + Command + L
![](../../users/profiles/2354845.webp)
Badr
- 1,621
- 1
- 18
- 26
-
2Thank you thank you so much. I hated that stupid formatting. – Bugs Happen Apr 11 '19 at 11:58
-
Instead of what is in this answer you have to switch to Project instead of Default in new installed studio 3.6.1 – Dmitriy Pavlukhin Mar 11 '20 at 13:15
21
You can edit your code styles under File > Settings > Editor > Code Style > XML
If you want to preview a specific file, just paste that file's contents into the preview window.
![](../../users/profiles/1176870.webp)
Chris Stillwell
- 9,136
- 7
- 65
- 67
-
1thanks, I accept this as answer, but it dosn't fix when createing new view in xml, the code is in one line, height, width,.... – Mohammad Hadi Nov 10 '18 at 18:56
10
Open File > Settings > Editor > Code Style > XML
Now in layout file make sure you have selected wrap attributes as Wrap always.
Screenshot
![](../../users/profiles/1000551.webp)
Vadim Kotov
- 7,103
- 8
- 44
- 57
![](../../users/profiles/6239306.webp)
efr
- 163
- 2
- 9