Unexpected auto-formatting of XML layout in Androi

2020-02-08 07:50发布

问题:

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)

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

回答1:

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:



回答2:

for me it's working

Open Settings > Editor > Code Style > XML > Arrangements
Click Set from... text
Select Predefined Styles > Android
Click Apply button

enter image description here