看老师的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. nyoj 5 Binary String Matching(string)

    Binary String Matching 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 Given two strings A and B, whose alp ...

  2. [luoguP2280] [HNOI2003]激光炸弹(DP)

    传送门 二位前缀和DP大水题 ——代码 #include <cstdio> #include <iostream> ; int n, r, ans; int sum[MAXN] ...

  3. Hihocoder 1333 (splay)

    Problem 平衡树 splay2 题目大意 维护一个序列,支持四种操作: 操作1:添加一个数,编号为x,权值为y. 操作2:删除编号在区间[x,y]内的数. 操作3:将编号在区间[x,y]内的数的 ...

  4. spark之scala快速入门

    scala和java都是在jvm之上的语言,相对来讲,scala热度比较低,其实并不是一个特别好的语言选择. 原因倒不是因为scala本身的缺点,而是使用人群不够多,论坛和社区不够活跃.这就跟社交软件 ...

  5. Ubuntu下常规方法安装软件

    一.通过apt-get 搜索: #搜索 apt-cache searche 7zip 安装: #安装 sudo apt-get install 7zip 更新: #查看特定软件的版本,前提是要安装ap ...

  6. 最简单的视音频播放演示样例7:SDL2播放RGB/YUV

    ===================================================== 最简单的视音频播放演示样例系列文章列表: 最简单的视音频播放演示样例1:总述 最简单的视音频 ...

  7. [Elasticsearch] 集群的工作原理 - 第一部分

    本文翻译自Elasticsearch官方指南的life inside a cluster一章. ES就是为高可用和可扩展而生的. 扩展能够通过购置性能更强的server(垂直扩展或者向上扩展,Vert ...

  8. JavaScript初探之——图片移动

    在我们打开页面的时候我们看到的大部分页面都是动态的,曾经学习VB的时候要实现一些动态的画面第一个想到的就是用Flash,如今学习了BS的东西,才算是开眼界了,刚刚学习了一个动画的效果,给大家展示一下. ...

  9. CocoaAsyncSocket网络通信使用之数据编码和解码(二)

    CocoaAsyncSocket网络通信使用之数据编码和解码(二) 在上一篇CocoaAsyncSocket网络通信使用之tcp连接(一)中,我们已经利用CocoaAsyncSocket封装了自己的s ...

  10. 解析cocos2d-lua项目中的Hello World

    创建完cocos2d-x的lua项目后.打开项目的Resources目录,找到hello.lua.cocos2d-x的lua项目的測试样例主要就是由这个脚本文件运行的. require "A ...