سؤال

I am working with Android in Eclipse.

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

<?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)

<?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

<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:.... Instead use @style/CustomActionBarTheme.

نصائح أخرى

You need to use

android:theme="@style/CustomActionBarTheme

You are referring to the style in your themes.xml.

There is not resource with the name @android:style/CustomActionBarTheme

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top