android的布局xml文件如何添加注释?
2015-06-23 21:24
495 查看
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开发:GridView与ListView相互切换(动画效果)
- Android中Fragment的知识
- Android OpenGL ES(三)----编程框架
- 安卓xml布局中 android:paddingBottom="@dimen/activity_vertical_margin"是什么意思?
- Android 图片裁剪 超出内存
- Android实战简易教程-第二十枪(GridView长按显示删除)
- android 伸缩控件ExpandableListView 展开失败的可能原因。
- android布局之 GridLayout的使用
- Activity的七大生命周期
- android-textview
- 通过Intent传输图片导致广播消息异常的问题根因分析(通过分析Android源码反向推理)
- Android 通知栏ANR原因
- Android入门之GridView(九宫图)
- android-RecyclerView
- Android深入浅出之Zygote
- Android CTS(兼容性测试)整个流程
- android:android Intent and IntentFilter
- Ubuntu14.04下搭建android5.1编译环境
- Android内核开发:系统启动速度优化
- Android的事件分发(二)