Have you tried customizing the textAppearance? That may avoid the
issue you're seeing - and may also be a better approach.

http://brainflush.wordpress.com/2009/03/15/understanding-android-themes-and-styles/

On Jan 10, 10:58 am, tlegras <[email protected]> wrote:
> Hi,
>
> I am trying to apply common style to different textview that can be
> either defined in a layout xml file or programmatically and that does
> not seem to work for some attributes:
> My style in styles.xml is:
>
>     <style name="ListName">
>         <item name="android:colorForeground">#f0f</item>
>         <item name="android:padding">4sp</item>
>         <item name="android:textSize">30sp</item>
>         <item name="android:textColor">#CCC</item>
>         <item name="android:gravity">left</item>
>         <item name="android:typeface">serif</item>
>         <item name="android:textStyle">bold</item>
>         <item name="android:colorBackground">#999</item>
>     </style>
>
> In my layout xml i have <TextView style="@style/ListName" ...></
> TextView>
> and in my activity java class i have:
>
>     TextView nametv = new TextView(this,null,R.style.ListName);
>
> However some parameters does not seem to work very well:
> - textStyle to bolditalic does not seems to be recognized
> - textColor/colorForeground/colorBackground does not work at all
>
> I have been through the documentation, but could not find precise
> reference documentation for that attributes, nor sample for the color
> setting.
>
> Thanks for any help.
> Thierry.
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to