简体   繁体   English

Android:自定义操作栏主题错误-(未找到匹配的资源。。。)

[英]Android: Custom Action Bar Theme Error - (No Resource Found that Matches . . .)

I am working with Android in Eclipse. 我正在Eclipse中使用Android。

So I'm trying to implement a custom theme, and I keep getting this error from my manifest file: 因此,我尝试实现自定义主题,并且不断从清单文件中收到此错误:

 error: Error: No resource found that matches the given name (at 'theme' with value   
'@android:style/CustomActionBarTheme').

Ideas? 有想法吗? Thanks! 谢谢!

AndroidManifest.xml AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="19" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/CustomActionBarTheme" >
    <activity
        android:name="com.example.myfirstapp.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <!--  A child of the main activity -->
    <activity
        android:name="com.example.myfirstapp.DisplayMessageActivity"
        android:label="@string/title_activity_display_message"
        android:parentActivityName="com.example.myfirstapp.MainActivity" >
        <!-- Parent activity meta-data to support 4.0 and lower --> 
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.myfirstapp.MainActivity" />
    </activity>
</application>

</manifest>

Themes.xml (Custom theme) 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.Holo">
    <item name="android:windowActionBarOverlay">true</item>
    <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
    <item name="android:actionMenuTextColor">@color/actionbar_text</item>
</style>

<!-- ActionBar Styles -->
<style name="MyActionBar"
       parent="android:style/Widget.Holo.ActionBar">
    <item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
</style>

<!-- ActionBar title text -->
<style name="MyActionBarTitleText"
       parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@color/actionbar_text</item>
</style>

<!-- ActionBar tabs text styles -->
<style name="MyActionBarTabText"
       parent="@android:style/Widget.Holo.ActionBar.TabText">
       <item name="android:textColor">@color/actionbar_text</item>
</style>
</resources>

Styles.xml Styles.xml

<resources>

<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:Theme.Holo.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here.
 -->
</style>

</resources>

You're referencing the system's resources when you use @android:... . 使用@android:...时,您正在引用系统资源。 Instead use @style/CustomActionBarTheme . 而是使用@style/CustomActionBarTheme

You need to use 您需要使用

android:theme="@style/CustomActionBarTheme

You are referring to the style in your themes.xml . 您是在themes.xml中引用样式。

There is not resource with the name @android:style/CustomActionBarTheme 没有名称为@android:style/CustomActionBarTheme

暂无
暂无

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

相关问题 Android:自定义主题:样式:检索项目父项:找不到与给定名称匹配的资源 - Android:Custom Theme:styles:Error retrieving parent for item: No resource found that matches the given name 错误:检索父项时出错:找不到与给定名称&#39;android:Theme.Holo.Light.DarkActionBar&#39;匹配的资源 - error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar' 错误:检索项目父项时出错:找不到与给定名称&#39;android:Theme.DeviceDefault.Light&#39;相匹配的资源 - error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.DeviceDefault.Light' 键入错误:检索项目的父项时出错:未找到与给定名称&#39;android:Theme.Holo.Light&#39;相匹配的资源。 - Type error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'. 错误:检索项目的父项时出错:找不到与给定名称“android:Theme.Holo”匹配的资源 - error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo' Eclipse Android插件问题“错误:找不到与给定名称匹配的资源(在“主题”处,值为“ @ style / AppTheme”)” - Eclipse Android plugin issue “Error: No resource found that matches the given name (at 'theme' with value '@style/AppTheme')” 检索项目的父项时出错:找不到与给定名称“android:Theme.Material.Light”匹配的资源 - Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light' 检索项目的父项时出错:找不到与给定名称匹配的资源&#39;@android:style / Theme.AppCompat.Light.DarkActionBar&#39; - Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.DarkActionBar' Unity构建错误:找不到与给定名称“ android:Theme.Holo.Light.NoActionBar.Fullscreen”匹配的资源 - Unity build error: No resource found that matches the given name 'android:Theme.Holo.Light.NoActionBar.Fullscreen' Android studio错误检索项目的父项:找不到与给定名称“Theme.AppCompat.Light.DarkActionBar”匹配的资源 - Android studio Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM