17

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?

new format

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57
Mohammad Hadi
  • 1,246
  • 3
  • 16
  • 30

3 Answers3

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

Badr
  • 1,621
  • 1
  • 18
  • 26
21

You can edit your code styles under File > Settings > Editor > Code Style > XML

Code Style Settings

If you want to preview a specific file, just paste that file's contents into the preview window.

Chris Stillwell
  • 9,136
  • 7
  • 65
  • 67
  • 1
    thanks, 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

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57
efr
  • 163
  • 2
  • 9