【问题标题】:XML attributes arrangement in Android StudioAndroid Studio 中的 XML 属性排列
【发布时间】:2017-02-26 14:20:28
【问题描述】:

I like to arrange my XML files similar to this question

但我想添加这样的排序:

  1. 查看 ID
  2. 风格
  3. 布局宽度和布局高度
  4. 其他layout_ 属性,按字母顺序排序
  5. 其余属性,按字母顺序排序

例子:

<Button
    android:id="@id/button_accept"
    style="@style/ButtonStyle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentStart="true"
    android:padding="16dp"
    android:text="@string/button_skip_sign_in"
    android:textColor="@color/bluish_gray" />

我查看了Editor -&gt; Code Style -&gt; XML -&gt; Arrangement,但我唯一能做的就是按字母顺序排列每个属性。 This documentation from IntelliJ couldn't help me 我仍然不确定namespace 应该做什么。

也许这里有人更了解它? UI给我的印象是,匹配规则的顺序就是,属性的​​顺序应该是怎样的。但不知何故,它并没有改变或做任何事情。

【问题讨论】:

    标签: xml android-studio intellij-idea


    【解决方案1】:

    我现在感觉很愚蠢,但我发现了我的错误:相关属性的名称需要以 android: 开头。

    结果:

    【讨论】:

    • 哇,这对我帮助很大。
    猜你喜欢
    • 2013-08-14
    • 2013-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-13
    • 1970-01-01
    相关资源
    最近更新 更多