错误:检索项目的父项时出错:找不到与给定名称“android:Theme.Holo”匹配的资源

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12295018/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 10:20:26  来源:igfitidea点击:

error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'

androidthemes

提问by Charan Pai

Error: No resource found that matches the given name: attr 'listViewStyle'

错误:找不到与给定名称匹配的资源:attr 'listViewStyle'

I have tried everything from here. Nothing is working.

我从这里尝试了一切。没有任何工作。

I have imported API demos to the eclipse of API version 15 and also giving error in src files like "The import com.example.android.apis.R cannot be resolved"

我已经将 API 演示导入到 API 版本 15 的 Eclipse 中,并且还在 src 文件中给出了错误,例如“无法解析导入 com.example.android.apis.R”

Help me out please.

请帮帮我。

I have error wit this in values-v11/styles.xmlfile

我在values-v11/styles.xml文件中有错误

<style name="ThemeHolo" parent="android:Theme.Holo">
</style>

<!-- For API level 11 or later, the Holo theme is available and we prefer that. -->
<style name="ThemeHoloDialog" parent="android:Theme.Holo.Dialog">
</style>

<!-- For API level 11 or later, we can use the magical DialogWhenLarge theme. -->
<style name="ThemeDialogWhenLarge" parent="android:style/Theme.Holo.DialogWhenLarge">
</style>

and also I have an error in values/styles.xml "error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Holo.Light.NoActionBar'." in following lines

而且我在 values/styles.xml 中有一个错误“错误:检索项目的父项时出错:找不到与给定名称匹配的资源'@android:style/Theme.Holo.Light.NoActionBar'。” 在以下几行

<style name="BadTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
</style>

回答by Adam L. Mónos

You can refer to the Holo theme as parent="@android:style/Theme.Holo", but to use the Holo Theme you have to set the build target in your manifest to API level 11 or later, also you have to put the style.xmlfile containing the Holo theme to the folder values-v11

您可以将 Holo 主题称为parent="@android:style/Theme.Holo",但要使用 Holo 主题,您必须将清单中的构建目标设置为 API 级别 11 或更高级别,还必须将style.xml包含 Holo 主题的文件放入文件夹values-v11

回答by Rajendra

Just delete the HOLO as this resource is not available for that API Level

只需删除 HOLO,因为该资源对该 API 级别不可用

        parent="android:Theme.Light"

回答by Syed 'sunny' I. Tauhidi

Changing the manifest's android:targetSdkVersionvalue to the correct version solved it for me.

将清单的android:targetSdkVersion值更改为正确的版本为我解决了这个问题。

回答by Syed 'sunny' I. Tauhidi

I have faced a similar issue even with the correct settings in Properties etc. It seems a problem with Eclipse. I have removed the content of the xml files, then "save", then enter again the values i.e.

即使在属性等中设置正确,我也遇到了类似的问题。这似乎是 Eclipse 的问题。我已经删除了 xml 文件的内容,然后“保存”,然后再次输入值,即

<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">

and "save" again.

并再次“保存”。

回答by monspo2

I resolved the same issue by adding

我通过添加解决了同样的问题

 android:theme="@style/AppTheme"    

within application tag in the AndroidManifest.xml file. This will recognize the app theme.

在 AndroidManifest.xml 文件中的应用程序标记内。这将识别应用程序主题。

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" 
        android:debuggable="true" > 
        <activity 
            ...
        </activity>
      ...
</application>

回答by pixelscreen

Have your written exactly this?

你写的正是这个吗?

<item name="android:listViewStyle">