看老师的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. [BZOJ2594] [Wc2006]水管局长数据加强版(LCT + kruskal + 离线)

    传送门 WC这个题真是丧心病狂啊,就是想学习一下怎么处理边权,给我来了这么一个破题! ORZ hzwer 临摹黄学长代码233 但还是复杂的一匹 理一下思路吧 题目大意:给定一个无向图,多次删除图中的 ...

  2. [fw]Best Practices for Exception Handling

    http://www.onjava.com/pub/a/onjava/2003/11/19/exceptions.html http://www.onjava.com/pub/a/onjava/200 ...

  3. PLSQL 下载地址 Spring jar包

    PLSQL   https://www.allroundautomations.com/ instantclient   http://www.oracle.com/technetwork/topic ...

  4. mysqlhighavailability

    http://mysqlhighavailability.com/getting-started-with-mysql-group-replication/

  5. nodejs shell

    REPL (Read-eval-print loop),即输入—求值—输出循环.如果你用过 Python,就会知道在终端下运行无参数的 python 命令或者使用 Python IDLE 打开的 sh ...

  6. git 手动操作

    git 手动操作 以下所有的情况都需要在上面那个目录下: 查看改动: git status // 所有改动都在这里. 提交代码: git add <file_name> // 把代码放到 ...

  7. Android SwipeToDismiss:左滑/右滑删除ListView条目Item

     <Android SwipeToDismiss:左右滑动删除ListView条目Item> Android的SwipeToDismiss是github上一个第三方开源框架(githu ...

  8. Scope Is the Enemy of Success

     Scope Is the Enemy of Success Dave Quick SCopE REFERS To A pRojECT'S SizE. How much time, effort, ...

  9. poj 1190 生日蛋糕 , 强剪枝

    题意: 制作一个体积为Nπ(N<=10000)的M(M<=20)层生日蛋糕,每层都是一个圆柱体. 设从下往上数第i(1 <= i <= M)层蛋糕是半径为Ri, 高度为Hi的圆 ...

  10. 【C++程序不输出】到底是什么造成了程序不输出

    (ubuntu 16.04) 最近做题的时候,经常莫名其妙地,程序写的明明没毛病但是就是输出不了,气得我呀 然后某一次突然发现了原因,竟然是输出之后没有加endl或者空格! 例如: cout<& ...