Cannot get textAppearance to inherit/cascade from theme

by Walt Armour » Fri, 19 Feb 2010 14:25:00 GMT

Sponsored Links
 I have a simple style like this:

        <style parent="android:Theme.Light.NoTitleBar" name="MyTheme">
            <item name="android:colorBackground">#FFFFFF</item>
            <item name="android:textAppearance">@style/PrimaryText</

And a simple style like this:

    <style parent="@android:style/TextAppearance" name="PrimaryText">
        <item name="android:textColor">#FF0000</item>
        <item name="android:textSize">14sp</item>

Now, I would expect (from reading everything that is documented) that
if I set the theme for my application like so:

    <application android:icon="@drawable/app_icon"
                                android:theme="@style/MyTheme" >

then anything in my app that has a textAppearance attribute (like a
TextView) would inherit the attributes from MyTheme (and thus the
attributes from PrimaryText).

But they don't.  I tried setting the theme on the specific activity
(in the manifest) and that did not work.  I set the style attribute on
the containing layout like this:


and that did nothing (which I believe is expected since this cascading
inheritance should only work when applied as a 'theme').

Am I missing something obvious here?  Right now I have to set the
textAppearance (or style) attribute on every single TextView to get
the style.  The pain is great.  Does anyone have a suggestion on a way
to get this to work?

While working this I also hit another oddity that may or may not be
related.  If I take the specific attributes (like textColor and
textSize) and put them in MyTheme then they do correctly cascade and
apply to all my text.  The problem is that they then cannot be
overridden by a style.  If I set textAppearance on a TextView it
appears to be ignored.  However, if I explicitly set textColor or
textSize then it will be honored and override the theme setting for
that TextView.

In general it feels like there is some missing wiring or a bit of
inconsistency in the application of themes and styling attributes.


Cannot get textAppearance to inherit/cascade from theme

by Prasanna Perera » Thu, 11 Mar 2010 02:06:24 GMT

 I am having this exact problem.  I am testing on the emulator.


Sponsored Links

Other Threads

1. Cannot Register Sipdroid With A Sip Account


I have been trying to register Sipdroid from an Android Emulator
without success. The project displays no errors- registration
parameters are ok- but when I try to make a call (inbound/outbound)
there is no response...implying the account does not yet recognise the
client...or something like that.

The service provider gave me the following configuration parameters
(which work when I use XLite):

authorisation username,
proxy address

Any ideas how to make this work?


2. How to use AsyncTask from a Thread?


I'm developing a game based on SurfaceView and a game thread for the
whole game thing (calculating/drawing/...).
Now I want to do some HTTP requests triggered on events inside the
thread. They should of course be asynchronous, so the game doesn't
I found AsyncTask to be a neat way to do this but I'm having trouble
implementing this at the moment. Maybe I misunderstood the concept of
AsyncTask , I don't know .. it just drives me nuts as I read docs and
blogs and still I don't get it. So sorry if that's a dumb question but
I'm mad of thinking about it.

--> What would be "best practice" to do asynchronous things out of a

Regards, F Heft

3. Getting the state of the Soft Input Method

4. MediaScannerConnectionClient which content provider?

5. How to detect orientation changed event in the webpage

6. Why I got the error "Sorry, this video cannot be played"

7. Reasons to Love Android