Android Studio 中意外的 XML 布局自动格式化 [英] Unexpected auto-formatting of XML layout in Android Studio

查看:68
本文介绍了Android Studio 中意外的 XML 布局自动格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 AS 已有 4 年了.上次更新后,我观察到 XML 布局的意外自动格式化(在键入和使用 Code -> Reformat Code 时也是如此).

这是一个例子:

  1. 当我开始输入相对布局时,它在同一行中扩展了开始标记、宽度属性、高度属性和结束标记.
  2. 属性在缩进之后开始.
  3. 重新格式化后视图之间没有空格.

问题

  • 这是新 AS 中的功能吗?那我怎样才能恢复它呢?
  • 我是否更改了某些设置?我应该修改什么设置才能恢复?(我试图在谷歌上找到但找不到任何东西)

我正在使用安卓工作室 3.2.1Build #AI-181.5540.7.32.5056338,建于2018年10月8日

解决方案

更新

<块引用>

如果您在使用 Android Studio 3.5 时遇到同样的问题,请查看以下文章

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

解决方案

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:

这篇关于Android Studio 中意外的 XML 布局自动格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆