zoukankan      html  css  js  c++  java
  • android的布局xml文件如何添加注释?

    xml布局文件如图添加注释后报错,错误内容如下:

    上网查阅xml添加注释的语法规则:

    XML 中的注释

    在 XML 中编写注释的语法与 HTML 的语法很相似:

    <!--This is a comment-->

    并不是注释本身的问题。

    因此可能是Android中的xml有特殊的规定,继续搜索发现有网友说:

    Android中的xml只能在组件布局代码后,或者在组件的前面添加注释。如下所示:
    <RelativeLayout
            android:id="@+id/item_layout"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:orientation="vertical" >
            <!--  -->
            <LinearLayout
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical" >
                      <!--  -->
            </LinearLayout>
    </RelativeLayout>

    果然这样之后就没有问题了。。。OTZ
  • 相关阅读:
    Python
    Python
    Python
    Python
    Python
    《The Rise and Fall of Scala》scala的兴衰
    Scala核心编程_第05章_函数式编程
    IntelliJ IDEA scala的源码设置
    Scala核心编程_第04章 程序流程控制
    Scala核心编程_第03章_运算符
  • 原文地址:https://www.cnblogs.com/yanpanjiao/p/4596310.html
Copyright © 2011-2022 走看看