Unexpected auto-formatting of XML layout in Android Studio

帅比萌擦擦* 提交于 2019-12-17 22:49:14

问题


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



来源:https://stackoverflow.com/questions/52853595/unexpected-auto-formatting-of-xml-layout-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!