Confused about TextAppearance style in compat v21 app

When I use appcompat v21

with a theme Light.DarkActionBar

in my application I have:

If I use ?android:textAppearanceMedium

, in my text greyish color

If I use @android:style/TextAppearance.Medium

in my text black color

What is the difference between the two? I thought they, by definition, should be the same, the second just a more explicit expression of the first?

+3


source to share


1 answer


The theme attribute is ?android:attr/textAppearanceMedium

set by the current theme, pointing to the style resource. On Theme and Theme.Light, it points to @android:style/TextAppearance.Medium

. On themes Theme.AppCompat it points to @android:style/TextAppearance.AppCompat.Medium

.



So, when you explicitly point to @android:style/TextAppearance.Medium

when your app is targeting Theme.AppCompat, you get a text appearance style designed for Gingerbread-enabled apps. If you use ?android:attr/textAppearanceMedium

this instead, you get the style that is tailored to your current theme.

+6


source







All Articles