Thanks for your answer

indeed i was a bit imprecise; in the xml way only setting the background
color does not work. i tried also to use this way

        <item name="android:colorBackground">@color/myblue</item>
        <item name="android:windowBackground">@color/myblue</item>

like mentionned in your link with no luck. whereas in the java code this
works fine:

        mytextview.setBackgroundColor(myBackgroundColor);

For the programmatical way to apply style to view, indeed i realized my
style is completly ignored.
it seems that line is not right:
        TextView nametv = new TextView(this,null,R.style.ListName);
the 3rd parameter is ignored.

So, so far i am stick both to use default background color (or to change
everything from code), and to set my text settings programmatically
whereever i have to create new textview in the code :(

Thierry.


On Mon, Jan 11, 2010 at 1:58 AM, joebowbeer <joe.bowb...@gmail.com> wrote:

> 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 <tleg...@gmail.com> 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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Thierry.
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to