android的XML文件凝视一般採用 <!--凝视内容 -->的方式进行

在XML中,形如    <Button           />      的表示方式,当中“/>”的含义表示这个XML中没有内文,他是一个最小组成单元,也就是说他的中间不能包括其它不论什么<
>的代码,所以在<Button />中间凝视会出现错误

注意看到,在凝视的前面有一个“>”符号,这就是我们可以在他中间进行凝视的原因,他的完整结构是

<RelativeLayout ></RelativeLayout>

这就不是最小组成单元的表示方式了

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout android:id="@+id/right"
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent">
  6. <!-- 在这里凝视是没有问题的 -->
  7. <TextView android:id="@+id/right_view1"
  8. android:background="@drawable/yellow" android:layout_width="fill_parent"
  9. android:layout_height="wrap_content" android:text="第二组第一项" />
  10. <!-- 在这里凝视也是没有问题的 -->
  11. <TextView android:id="@+id/right_view2"
  12. android:background="@drawable/blue"
  13. android:layout_width="fill_parent"
  14. android:layout_height="wrap_content"
  15. android:layout_below="@id/right_view1" android:text="第二组第二项" />
  16. </RelativeLayout>

即仅仅能在组件布局代码后,或者在组件的前面加入凝视。例如以下所看到的:

<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>

怎么在android的XML文件里加入凝视的更多相关文章

  1. 自动帮助创建android资源xml文件的网站

    自动帮助创建android资源xml文件的网站 http://android-holo-colors.com/ stack overflow上一个seekbar的例子: http://stackove ...

  2. android 创建 xml文件

    android创建xml文件的方法. 要操作android的外部存储,所以要在AndroidManifest.xml文件中添加权限. <uses-permission android:name= ...

  3. android解析xml文件的方式

    android解析xml文件的方式   作者:东子哥 ,发布于2012-11-26,来源:博客园   在androd手机中处理xml数据时很常见的事情,通常在不同平台传输数据的时候,我们就可能使用xm ...

  4. 不在JPA 的 persistence.xml 文件里配置Entity class的解决的方法

     在Spring 集成 Hibernate 的JPA方式中,须要在persistence配置文件里定义每个实体类.这样很地不方便.2种方法能够解决此问题: 这2种方式都能够实现不用在persist ...

  5. duilib中加入自己定义控件之后怎么可以在xml文件里配置使用

    加入自己定义控件可能有两种不同的情况: 1.  在duilib库中加入的自己定义控件. 2.  在我们的应用程序中自己重写了一个控件. 以下開始解说不同的情况下怎么才干支持在xml文件配置控件: 1. ...

  6. mybatis 的 dao 接口跟 xml 文件里面的 sql 是如何建立关系的?一步步解析

    序言 在开始正文之前,首先解释Dao接口和XML文件里的SQL是如何一一对应的? 一句话讲完就是:mybatis 会先解析这些xml 文件,通过 xml 文件里面的命名空间 (namespace)跟d ...

  7. 曹工说Spring Boot源码(15)-- Spring从xml文件里到底得到了什么(context:load-time-weaver 完整解析)

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  8. 曹工说Spring Boot源码(16)-- Spring从xml文件里到底得到了什么(aop:config完整解析【上】)

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  9. 曹工说Spring Boot源码(17)-- Spring从xml文件里到底得到了什么(aop:config完整解析【中】)

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

随机推荐

  1. RedGate 工具SQLTEST 1.0.15.1

    原文:RedGate 工具SQLTEST 1.0.15.1 RedGate 工具SQLTEST 1.0.15.1 SQL TEST1.0.15.1的破解可以参考这篇文章:http://www.cnbl ...

  2. Sencha Architect 2 的使用

    俗话说的好, 工欲善其事必先利其器, 用Sencha开发的语言, 自己可能不太熟悉, 写出来很麻烦, 于是给大家介绍一个工具. 启动程序第一个界面: 单击第一个Go按钮, 创建一个项目.进入以后, 单 ...

  3. C# Windows Phone 8 WP8 , 文字超连结到网页 免打程式码,Xaml就搞定 ! !

    原文:C# Windows Phone 8 WP8 , 文字超连结到网页 免打程式码,Xaml就搞定 ! ! 一般我们在开发Windows Phone 8 APP ,有时会需要超连结连到其他的网页,但 ...

  4. 191. Number of 1 Bits Leetcode Python

    Write a function that takes an unsigned integer and returns the number of '1' bits it has (also know ...

  5. Atitit.列表页and查询条件的最佳实践(1)------设定搜索条件and提交查询and返回json数据

    Atitit.列表页and查询条件的最佳实践(1)------设置查询条件and提交查询and返回json数据 1. 1. 配置条件字段@Conditional 1 1 2. 2. 配置条件字段显示类 ...

  6. table 谷歌下不出现滚动条

    <table> </table> <style> table {overflow-y:scroll;max-height:152px; height:auto;} ...

  7. UITabBarController详细说明(简介和设置)

    [objc] view plaincopy - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions ...

  8. 离PACKET_INp获取信息acket data

         于Floodlight模块假设要packet in消息,就对对应的消息类型进行监听就可以.然后在receive方法中就能够操纵这个上传上来的packet_in.      关键代码:   E ...

  9. Android - 和其他APP交互 - 让其他app启动你的activity

    前面的两篇文章主要讲了一个方面:从app中启动其他app.但是如果你的app可以处理对其他app有用的操作,你的app也应该响应其他app的操作请求.例如,如果你创建了一个社交app可以分享信息和图片 ...

  10. C语言标准库函数qsort具体解释

    1 函数简单介绍 功 能: 使用高速排序例程进行排序 头文件:stdlib.h 用 法: void qsort(void *base,int nelem,int width,int (*fcmp)(c ...