首页 > 解决方案 > Android Studio:XML 布局中的意外重新格式化代码

问题描述

我现在使用的是 Android Studio 3.5,在上次更新后,我观察到 XML 布局的意外自动格式化。

在我的布局中,我有:

<androidx.constraintlayout.widget.ConstraintLayout ...
<TextView ...
<ImageView ...
<TextView ...
</androidx.constraintlayout.widget.ConstraintLayout>

重新格式化代码后 Code -> Reformat Code ,我的布局以一种意想不到的和不需要的形式发生了变化:

<androidx.constraintlayout.widget.ConstraintLayout ...
<ImageView ...
<TextView ...
<TextView ...
</androidx.constraintlayout.widget.ConstraintLayout>

问题

标签: androidandroid-layoutandroid-studio-3.5

解决方案


推荐阅读