看老师的word文档开始学习。复制了一段代码,在layout中新建了一个Android XML file,发现有提示错误。

  代码如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical" >
    <TextView android:id="@+id/text"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Hello, I am a TextView" />
    <Button android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello, I am a Button" />
</LinearLayout>

   错误的提示是这样的:Element type "LinearLayout" must be followed by either attribute specifications, ">" or "/>".

  在网上找了很久,都没有找到我理想的解决方案。这样几个小时就过去了。

  后来自己无意间试了出来一种办法,居然可以消除这种错误。那就是右键点击这个xml文件,然后new -> Android XML flie -> finish。也就是新建一个相同名字的xml文件来覆盖这个文件。感觉内容是没有修改的,但是就是正确了。我的猜测是:word和eclipse的编码可能不同。但是具体是什么原因就不知道了。

  

Element type "LinearLayout" must be followed by either attribute specifications, ">" or "/>"的解决办法的更多相关文章

  1. Element type "bean" must be followed by either attribute specifications, ">" or "/>".

    在这里其他内容就省了,错在,<bean id="bpcsU1gblDAO"class="dao.jk.bpcs.impl.BpcsU1gblDaoImpl" ...

  2. MVC中异常: An exception of type 'System.Data.ProviderIncompatibleException' occurred in EntityFramework.dll的一种解决办法

    今天在调试MVC的例子的时候,总是出错(An exception of type 'System.Data.ProviderIncompatibleException' occurred in Ent ...

  3. java出现The type java.lang.Object cannot be resolved. It is indirectly referenced.....解决办法

    当你在Eclipse引用不同版本JDK工程时会发生该问题.由于你开发环境中应用了多个版 本的JDK 或JRE导致的.Eclipse会按照最初的开发环境默认选择对应的Jre.如Eclipse上有jdk1 ...

  4. Multiple annotations found at this line: - The content of element type "mapper" must match "EMPTY". - Attribute "namespace" must be declared for element type "mapper".

    今天在mybatis的mapper映射配置文件中遇到了这样的问题,困扰了我3个小时: Multiple annotations found at this line: - The content of ...

  5. The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProv

    在mybatis配置文件config.xml中报错: The content of element type "configuration" must match "(p ...

  6. The content of element type "package" must match "(result-types?,interceptors?...

    错误:“The content of element type "package" must match "(result-types?,interceptors?,de ...

  7. The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC & ...

  8. Open quote is expected for attribute "property" associated with an element type "result".错误

    java  Mybatis 框架下的项目 报   Open quote is expected for attribute "property" associated with a ...

  9. web.xml配置bug之提示The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,

    错误:配置web.xml时,出现红色叉叉,提示 The content of element type "web-app" must match "(icon?,disp ...

随机推荐

  1. MySQL慢日志切割邮件发送脚本

    #!/bin/bashtime=`date -d yesterday +"%Y-%m-%d"`slowlog='/usr/local/percona/data/slow.log'# ...

  2. Linux查看设备信息命令

    系统 #查看内核/操作系统/CPU信息 uname -a #查看操作系统版本 head -n 1 /etc/issue #查看CPU信息 cat /proc/cpuinfo #查看计算机名 hostn ...

  3. JSP计数器

    1.JSP弥补了servlet页面显示的不足:jsp运行时候需要转化为servlet,本质上就是servlet:tomcat下的work目录下有jsp的servlet和对应的class文件;下次再调用 ...

  4. 只用html和css画出不等分圆盘,不用canvas

    <style> .box{height: 200px;width: 200px;border-radius: 100%; overflow: hidden; margin: 200px; ...

  5. 微軟将弃用 System.Data.OracleClient

    http://www.cnblogs.com/WizardWu/archive/2010/05/17/1737009.html 微軟将从 .NET 4 以后的版本弃用 System.Data.Orac ...

  6. HDU 5311 Hidden String (优美的暴力)

    Hidden String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) ...

  7. 修改Cygwin的默认启动目录

    安装Cygwin后发现Cygwin默认的用户主目录是Windows的用户主目录(一般为:C:\Users\[UserName]\),要想修改为cygwin安装目录下的home\[UserName]\可 ...

  8. UVA - 10324 Zeros and Ones

    Description Given a string of 0's and 1's up to 1000000 characters long and indices i and j, you are ...

  9. 日常工作中常见的mysql优化技巧

    1.介绍一下MYSQL经常使用的优化技巧. MySQL 自带 slow log 的分析工具 mysqldumpslow ,可是没有说明.本文通过分析该脚本,介绍了其用法. slow log 是 MyS ...

  10. YTU 2732:3798-Abs Problem

    2732: 3798-Abs Problem 时间限制: 1 Sec  内存限制: 128 MB  Special Judge 提交: 167  解决: 60 题目描述 Alice and Bob i ...