user3690202
user3690202

Reputation: 4045

How to refer to a theme in style.xml from the AndroidManifest

I am trying to override some values in the theme for my Android application. The AndroidManifest.xml file has the following declaration for the application:

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="App"
    android:supportsRtl="true"
    android:theme="@android:style/AppTheme" >

And in my style I have the following theme declared:

    <style name="AppTheme" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen">
        <item name="android:typeface">serif</item>
    </style>

However when I build the project android studio says "Error:(28, 24) No resource found that matches the given name (at 'theme' with value '@android:style/AppTheme')."

How can I reference the theme from the manifest file? It works for the built in themes (such as Theme.Black.NoTitleBar.Fullscreen, for example)

Upvotes: 0

Views: 793

Answers (2)

Sofiane Daoud
Sofiane Daoud

Reputation: 878

when you use @android:style you are referring resources included in the android sdk, to use you own you should only use @style, or other resources @drawable, @string, etc.

Upvotes: 0

Stefan
Stefan

Reputation: 2178

You only have to use @style without the android prefix. Like this:

android:theme="@style/AppTheme" >

Upvotes: 2

Related Questions