Friday, March 11, 2011

[android-developers] Re: Change the text style according to state, in XML

No, I don't want to change its color, only its textStyle attribute. I
tried using a selector but it crashes:

03-11 08:38:20.907: ERROR/AndroidRuntime(803): Caused by:
java.lang.NumberFormatException: Invalid int: "res/drawable/
selected_bold.xml"

On Mar 10, 5:51 pm, Justin Anderson <magouyaw...@gmail.com> wrote:
> *> Does someone know if it's possible to change a text view style (bold,
>
> > italic...) according to its state (pressed, selected...), the same way
> > a drawable can depend on the state using a <selector>?*
>
> Yes, it is possible.  Set the textColor attribute to something like this:
> android:textColor="@drawable/my_text_color_selector"
>
> I have done this on several occasions.
>
> Thanks,
> Justin Anderson
> MagouyaWare Developerhttp://sites.google.com/site/magouyaware
>
> 2011/3/10 Clément Plantier <clemplant...@gmail.com>
>
>
>
>
>
>
>
> > Does someone know if it's possible to change a text view style (bold,
> > italic...) according to its state (pressed, selected...), the same way
> > a drawable can depend on the state using a <selector>?
> > I don't want to do that in Java, only with XML styles, but it seems
> > that's not possible.
>
> > --
> > 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+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment