重新格式化时,如何使 XML 代码中的命名空间属性出现在下一行
How to make namespace attr in XML code appear on the next line when reformatted
每次我重新格式化我的 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">
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">
有人可以帮我解决这个问题吗?
这是我的AndroidStudio中的XML属性排列:
- 前往
File
-> Settings
-> Editor
-> Code style
-> XML
.
- 有4个子菜单(
Tabs and Intents
,Other
,Arrangement
,Android
),selectAndroid
.
- 在右侧,
Layout Files
下方勾选 Insert line break before first attribure
、Include namespace declarations
。
每次我重新格式化我的 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">
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">
有人可以帮我解决这个问题吗?
这是我的AndroidStudio中的XML属性排列:
- 前往
File
->Settings
->Editor
->Code style
->XML
. - 有4个子菜单(
Tabs and Intents
,Other
,Arrangement
,Android
),selectAndroid
. - 在右侧,
Layout Files
下方勾选Insert line break before first attribure
、Include namespace declarations
。