简体   繁体   English

找不到与给定名称'@ style / Theme.AppCompat.Light'相匹配的资源

[英]No resource found that matche the given name '@style/Theme.AppCompat.Light'

I'm facing few problems related to the theme. 我面临与主题相关的几个问题。

In my manifest, I have the following code: 在清单中,我有以下代码:

<application
    android:theme="@android:style/Theme.AppCompat.Light">

By using the above code, there is error No resource found that matches the given name '@style/Theme.AppCompat.Light' . 通过使用上面的代码,没有错误No resource found that matches the given name '@style/Theme.AppCompat.Light' Please refer to the image below that I've added the reference. 请参考下图,我已经添加了参考。

If I remove the theme setting, I'll receive runtime error saying that I must implement AppCompat theme. 如果删除主题设置,则会收到运行时错误消息,提示我必须实现AppCompat主题。 May I know which part has gone wrong? 我可以知道哪一部分出了错吗?

在此处输入图片说明

As it seems you have referenced appcompat v7 library in your project, my initial guess is that you should use 好像您在项目中引用了appcompat v7库一样,我最初的猜测是您应该使用

<application
android:theme="@style/Theme.AppCompat.Light">

instead of 代替

<application
android:theme="@android:style/Theme.AppCompat.Light">

Also ensure that both Android Support Library project and the Main Project have the same minSdkVerson and targetSdkVersion . 还要确保Android支持库项目和主项目都具有相同的minSdkVersontargetSdkVersion

The key thing here i guess is that in the parent attribute android: .It prefixes built in themes (styles), while a value without this prefix references your own styles or the styles in any libraries you have linked to, in this case android-support-v7-appcompat . 我想这里的关键是在android:的parent属性中android:它以主题(样式)为前缀,而没有此前缀的值引用您自己的样式或您链接到的任何库中的样式,在这种情况下为android-support-v7-appcompat

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到与给定名称“ @ style / Theme.AppCompat.Light”匹配的资源 - No resource found that matches the given name '@style/Theme.AppCompat.Light' 找不到与给定名称“ Theme.AppCompat.Light”匹配的资源 - No resource found that matches the given name 'Theme.AppCompat.Light' Android:找不到与给定名称匹配的资源:Theme.AppCompat.Light - Android: No resource found that matches the given name :Theme.AppCompat.Light 找不到与给定名称匹配的资源:attr&#39;colorPrimary&#39;Theme.AppCompat.Light - No resource found that matches the given name: attr 'colorPrimary' Theme.AppCompat.Light 找不到与给定名称“ Theme.AppCompat.Light”匹配的资源。 Android Studio - No resource found that matches the given name 'Theme.AppCompat.Light'. Android Studio 寻求帮助:“错误:检索项目父项时出错:找不到与给定名称&#39;Theme.AppCompat.Light&#39;相匹配的资源” - Asking for help: “error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light' ” Theme.appcompat.light找不到资源 - Theme.appcompat.light no resource found 如何修复Mac版的android eclips“错误检索父项:找不到与给定名称&#39;Theme.AppCompat.Light&#39;相匹配的资源? - How to fix mac version of android eclips 'Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'? 从Eclipse中的源代码创建Android项目:检索项目的父项时出错:未找到与给定名称&#39;Theme.AppCompat.Light&#39;匹配的资源 - Create Android project from source in Eclipse: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light' 检索项目的父项时出错:找不到与给定名称“Theme.AppCompat.Light”匹配的资源。 我的R.java失踪了 - Error retrieving parent for item:No resource found that matches the given name 'Theme.AppCompat.Light'. MY R.java is missing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM