当你的androidAPI 由2.1版本更换成2.2版本时:
 res/vavlues/styles.xml中使用的android:WindowTitle会报以下异常,
error: Error retrieving parent for item: No resource found that matches the given name 'android:WindowTitle'.
从而导致我们的程序无法编译通过。
 
原因:
android2.1中的某些API(包括类方法或者XML属性)更换成android2.2时,它们的路径已经发生了改变,从而导致编译器无法找到它们,所以编译无法通过。
 
 

解决方案:

1. 在Eclipse中打开任意一个.java文件,输入
   android.R.style.
   这时你会看到一个提示列表,仔细看看,里面确实没由WindowTitle, 但是我们发现了一个TextAppearance_WindowTitle. 没错, 在android2.2中,它已经被改成了TextAppearance_WindowTitle。
 
2. 回到报错的res/values/styles.xml, 将<style name="XWindowTitle" parent=""> 
   相应地修改成
  <style name="XWindowTitle" parent="android:TextAppearance.WindowTitle">
 
  注意:这里你也许会注意到 .java文件中的XML属性,与 .xml文件中XML属性很是类似。
  这不是巧合,android官方文档规定:
  java文件中的android.R.style.TextAppearance_WindowTitle 对应
  xml文件中的android:TextAppearance.WindowTitle。 “下划线”与“点”时对应关系。
 
关于Styles and Themes 之间的关系,请参考官方网站

No resource found that matches the given name 'android:WindowTitle'的更多相关文章

  1. 项目引入android-support-v7-appcompat遇到的问题,no resource found that matches the given name 'android:Theme.AppCompat.Light'

    一.问题 今天准备使用v7包中的ToolBar来用,但是在styles.xml中引入Theme.AppCompat.Light的时候,报错“no resource found that matches ...

  2. error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.

    引用appcompat 类库提示 error: Error retrieving parent for item: No resource found that  matches the given ...

  3. Android - 错误:&quot;No resource found that matches the given name android:Theme.Material&quot;

    Android - 错误:"No resource found that matches the given name android:Theme.Material" 本文地址:  ...

  4. No resource found that matches the given name 'android:Widget.Material.A解决方案

    1:首先新建空白工作区 2:先import appcompat_v7 appcompat_v7在一个类似这样的地方, C:\mywork\android\android-sdk-windows\ext ...

  5. Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.

    改下build.gradle文件,将里面的compileSdkVersion改为23即可 apply plugin: 'com.android.application' android { compi ...

  6. 解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题

    解决Android中No resource found that matches android:TextAppearance.Material.Widget.Button.Inverse问题http ...

  7. eclipse新建项目,报错“Error: workspace\appcompat_v7\res\values-v21\styles_base.xml No resource found that matches the given name”

    新建项目报错,不知道为什么,以前从未出现过的错误,把sdk更新之后,出现莫名错误,自己也是一知半解,在网上找了好久的错误,终于在一个english网站找到了解决方法,soga,从未觉得english如 ...

  8. 【转】eclipse新建项目,报错“Error: workspace\appcompat_v7\res\values-v21\styles_base.xml No resource found that matches the given name”

    原文网址:http://www.cnblogs.com/mbp-study/p/5268478.html 新建项目报错,不知道为什么,以前从未出现过的错误,把sdk更新之后,出现莫名错误,自己也是一知 ...

  9. android中出现Error retrieving parent for item: No resource found that matches the Theme.AppCompat.Light

    styles.xml中<style name="AppBaseTheme" parent="Theme.AppCompat.Light">提示如下错 ...

随机推荐

  1. [LeetCode]题解(python):009-Palindrome Number

    题目来源: https://leetcode.com/problems/palindrome-number/ 题意分析: 这题是要判断一个int是否一个回文数,要求不能申请额外的空间. 题目思路: 这 ...

  2. django virtualenv

    1. virtualenv virtualenv用于创建独立的Python环境,多个Python相互独立,互不影响,它能够:1. 在没有权限的情况下安装新套件2. 不同应用可以使用不同的套件版本3. ...

  3. 第二节 EAN 8 码 / EAN 13 码

    EAN码的全名为欧洲商品条码(European Article Number),源於西元1977年,由欧洲十二个工业国家所共同发展出来的一种条码.目前已成为一种国际性的条码系统.EAN条码系统的管理是 ...

  4. Qt Creator error: LNK1123: 转换到 COFF 期间失败: 文件无效或损坏

    Qt Creator error: LNK1123: 转换到 COFF 期间失败: 文件无效或损坏   治标又治本的解决方法:   找到在 { C:\Windows\Microsoft.NET\Fra ...

  5. Linux android studio :'tools.jar' seems to be not in Android Studio classpath.

    问题: 'tools.jar' seems to be not in Android Studio classpath.Please ensure JAVA_HOME points to JDK ra ...

  6. POJ 2486 Apple Tree ( 树型DP )

    #include <iostream> #include <cstring> #include <deque> using namespace std; #defi ...

  7. Android开发之TextView排版问题

    下面直接是关于解决该问题的代码(根据别人的代码进行了修正以及测试,保证可以修改字体尺寸.颜色.根据padding调整,如果需要支持其他的格式可以将对应的属性添加至Paint类型的对象中):   1 p ...

  8. KindEditor - 代码高亮

    *:插入数据库的数据,不用转义,KE已经自动转义过了. 调用的时候使用引入代码的css: 显示代码的页面:

  9. javascript 学习随笔

    var carname="Volvo"; var carname; 重新声明变量后变量的值不变,在这里还是volvo var carname="Volvo"; ...

  10. vmware时间不同步的问题

    请以管理员身份运行(root)