Search code examples
androidandroid-manifestandroid-themeandroid-styles

Inheriting Android Themes


I'm targeting sdk7 or Android 2.1. Here's my styles.xml that is in my values folder.

<resources>
<style name="AppTheme" parent="android:Theme">
    <item name="android:windowNoTitle">true</item>
    <item name="textAppearance">@android:style/TextAppearance</item>
</style>

<style name="PrimaryText" parent="@android:style/TextAppearance">
    <item name="android:textColor">#fff7c4</item>
</style>

And here is Android's "Theme"

<style name="Theme">
    <!-- Text styles -->
    <item name="textAppearance">@android:style/TextAppearance</item>
    <item name="textAppearanceInverse">@android:style/TextAppearance.Inverse</item>

The Problem: Eclipse is giving me an error message of "No resource found that matches the give name: attr 'textAppearance'

This isn't true. I can see it right there in Android's theme that I'm extending. Why is there an error?

SOLUTION: DOH, add the freakin' name space:

<item name="android:textAppearance">@style/PrimaryText</item>

don't just copy and paste from Android's theme


Solution

  • DOH, add the freakin' name space:

    <item name="android:textAppearance">@style/PrimaryText</item>
    

    don't just copy and paste from Android's theme