Spoonface
Spoonface

Reputation: 1563

Android manifest doesn't recognise a system theme listed in styles.xml

In my manifest the app theme points to an android style listed in the styles.xml file:

<manifest 
xmlns:android="http://schemas.android.com/apk/res/android"
package="test.theme"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="16"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

styles.xml:

<resources>
    <style name="AppTheme" parent="android:Theme.Black" />
</resources>

but for some reason the theme isn't recognised and it loads a white theme instead. Yet it functions as expected when I put the theme directly into the manifest like this:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Black" >

Even in an empty default project the same problem occurs. The value AppTheme is listed in R.java so the file is being recognised ok. Does anyone have any other ideas what the problem might be?

Upvotes: 2

Views: 3360

Answers (1)

Spoonface
Spoonface

Reputation: 1563

I did eventually solve this issue, it was a pretty simple one in the end.

There was a platform specific values-v14/styles.xml file that I should have put my styles in, as the default values in this sheet were taking precedence to the changes I was making to the global values/styles.xml file.

So if anyone ends up here with the same problem, you might want to check you're saving in the correct styles.xml file for your target platform.

Upvotes: 2

Related Questions