gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-11-01 08:19:23 27 4
gpt4 key购买 nike

每次我重新格式化我的 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 中玩过 Code Style 菜单的 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属性排列: XML attr arrangement

最佳答案

  1. 转到文件 -> 设置 -> 编辑器 -> 代码风格 -> XML
  2. 有4个子菜单(Tabs and IntentsOtherArrangementAndroid),选择Android
  3. 在右侧,Layout Files 下方,检查 Insert line break before first attribureInclude namespace declarations

enter image description here

关于android - 重新格式化时如何使XML代码中的命名空间attr出现在下一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53361061/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com