Unexpected auto-formatting of XML layout in Android Studio

HBB20 picture HBB20 · Oct 17, 2018 · Viewed 8.7k times · Source

I am using AS since 4 years. After last update I observed unexpected auto-formatting of XML layout (while typing and with Code -> Reformat Code too).

Here is an example:

  1. When I started typing relative layout, it expanded start tag, width property, height property and closing tag in the same line.
  2. Properties starts after indentation.
  3. No space between views after reformat.

Question

  • Is this a feature in new AS? then how can I revert it back?
  • Did I change some setting? What setting should I modify to revert back? (I tried to find on google but could not find anything)

enter image description here

I am using Android Studio 3.2.1 Build #AI-181.5540.7.32.5056338, built on October 8, 2018

Answer

AskNilesh picture AskNilesh · Oct 17, 2018

Update

if you facing same issue with Android Studio 3.5 please check below article

Android Studio 3.5 Upgrade XML Reformatting Problems

Open File > Settings > Editor > Code Style > XML

Now in layout file make sure you have selected wrap attributes as Wrap always

Like below screenshot:

enter image description here