简体   繁体   English

检索项目的父项时出错:找不到与给定名称匹配的资源'@android:style / Theme.AppCompat.Light.DarkActionBar'

[英]Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.DarkActionBar'

I'm following the android development tutorials from developers.android.com, and currently I'm trying to style my action bar using the information given here: https://developer.android.com/training/basics/actionbar/styling.html#CustomBackground7 我正在关注来自developers.android.com的android开发教程,目前我正在尝试使用此处给出的信息设置我的操作栏: https//developer.android.com/training/basics/actionbar/styling。 HTML#CustomBackground7

Here's the code of res/values/themes.xml: 这是res / values / themes.xml的代码:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@android:style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>

    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
           parent="@android:style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@drawable/actionbar_background</item>
        <!-- Support library compatibility -->
        <item name="background">@drawable/actionbar_background</item>

    </style>
</resources>

I see red cross icons beside the "style" opening tags, hovering on which the error message reads: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.DarkActionBar'. 我在“样式”开始标记旁边看到红色十字图标,悬停在错误消息上:错误:检索项目的父项时出错:找不到与给定名称匹配的资源'@android:style / Theme.AppCompat.Light.DarkActionBar ”。

  • My application has minSdkVersion="11" and targetSdkVersion="21", I tried changing the minSdkVersion to 13, 14 but it made no difference 我的应用程序有minSdkVersion =“11”和targetSdkVersion =“21”,我尝试将minSdkVersion更改为13,14,但它没有区别
  • Someone suggested to check whether appcompat has been marked as library project or not, I checked it and the "isLibrary" option was checked in the appcompat properties window. 有人建议检查appcompat是否已被标记为库项目,我检查了它,并在appcompat属性窗口中选中了“isLibrary”选项。
  • I also made sure that appcompat was added to my project as a library project. 我还确保appcompat作为库项目添加到我的项目中。
  • removing "@android" from "@android:style" or removing the "@" doesn't work. 从“@android:style”中删除“@android”或删除“@”不起作用。 However in the first style tag, when I remove "@android" then the red cross sign goes away, but that doesn't happen for the second style tag. 但是在第一个样式标记中,当我删除“@android”时,红色十字标记会消失,但第二个样式标记不会发生这种情况。

Please help. 请帮忙。 I've been at it since morning and I'm not getting anywhere. 我从早上起就一直在这里,而且我没有到达任何地方。

Try to delete android: , like this: 尝试删除android: ,像这样:

<style name="CustomActionBarTheme"
       parent="@style/Theme.AppCompat.Light.DarkActionBar">

暂无
暂无

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

相关问题 检索主题theme.appcompat.light.darkactionbar的父项时出错 - error retrieving parent for item theme.appcompat.light.darkactionbar Theme.AppCompat.Light.DarkActionBar - 找不到资源 - Theme.AppCompat.Light.DarkActionBar - No resource found 检索项目的父项时出错:找不到与给定名称“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 错误:找不到与给定名称匹配的资源(在“主题”处,值为“ @ style / Theme.Material.Light.DarkActionBar”) - Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.Material.Light.DarkActionBar') 检索项目的父项时出错:找不到与给定名称&#39;@android:style / AlertDialog&#39;匹配的资源。 和&#39;@android:style / DialogWindowTitle&#39; - Error retrieving parent for item: No resource found that matches the given name '@android:style/AlertDialog'. and '@android:style/DialogWindowTitle' 检索父项时出错:找不到与给定名称android相匹配的资源 - Error retrieving parent for item: No resource found that matches the given name android 错误:检索项目的父项时出错:找不到与给定名称“ Widget.AppCompat.Base”匹配的资源 - error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base' 找不到与给定名称“ Theme.AppCompat.Light”匹配的资源。 Android Studio - No resource found that matches the given name 'Theme.AppCompat.Light'. Android Studio 检索父项时出错:找不到与Eclipse中给定名称匹配的资源 - Error retrieving parent for item: No resource found that matches the given name in Eclipse 如何在Theme.AppCompat.Light.DarkActionBar主题中更改菜单项的文本颜色? - How to change the text color of a menu item in Theme.AppCompat.Light.DarkActionBar theme?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM