重新格式化时如何使 XML 代码中的命名空间属性出现在下一行

Mir*_*qov 5 xml android android-layout android-xml android-studio

每次我重新格式化我的 XML 代码时,都会xmlns向上移动到写入根元素标记名称的行。

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
Run Code Online (Sandbox Code Playgroud)

xmlns:android...旁边是CoordinatorLayout。我在 AndroidStudio 中使用了代码样式菜单的 XML 部分,但无法做到。当我重新格式化我的布局 XML 文件时,这就是我想要的:

<android.support.design.widget.CoordinatorLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
Run Code Online (Sandbox Code Playgroud)

有人可以帮我弄这个吗?

这是我的 AndroidStudio 中的 XML 属性排列: XML 属性排列

tm1*_*m13 6

  1. File-> Settings-> Editor-> Code style-> XML
  2. 有 4 个子菜单(Tabs and IntentsOtherArrangementAndroid),选择Android
  3. 在右侧,Layout Files检查下方的Insert line break before first attribure, Include namespace declarations

在此处输入图片说明