码迷,mamicode.com
首页 > 移动开发 > 详细

android的布局xml文件如何添加注释?

时间:2015-06-23 23:06:56      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

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

android的布局xml文件如何添加注释?

标签:

原文地址:http://www.cnblogs.com/yanpanjiao/p/4596310.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!