android - Android Studio 中 XML 布局的意外自动格式化

标签 android android-studio android-layout android-xml android-studio-3.0

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

这是一个例子:

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

问题

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

enter image description here

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

最佳答案

更新

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

Android Studio 3.5 Upgrade XML Reformatting Problems

打开 文件 > 设置 > 编辑器 > 代码样式 > XML

现在在布局文件中,确保您已将包装属性选择为 始终包装

如下截图:

enter image description here

关于android - Android Studio 中 XML 布局的意外自动格式化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52853595/

相关文章:

android - 彼此后面的两个 TextView,仅椭圆化第一个,第二个始终可见

android - 将复选框与 ListView 项目的中心对齐

google-maps - 在非 Activity 类中使用 TextView 资源。 MainActivity 停止并显示 "Exception despatching input event."

android - (多个按钮)如何将多个 XML 文件链接到 Android 应用程序的 1 个主要 Java 页面?

android - android 中的空闲时间?

java - 上下文无法解析为类型

Android Studio KMM iOS 运行不会在 iPhone 模拟器中启动

android - xmlns ="http://maven.apache.org/POM/4.0.0"URI 未注册

java - 在 Mac 上的 Android Studio 中找不到 OnePlus One

android - 使用 videoview 流式传输视频