Well, actually what i did is:

Get the text "Hello this is a text in
black color and (COLOR_RED_BEGIN)this is a text in red color.
(COLOR_RED_END)" and replace the (COLOR_RED_BEGIN) by
<font color=0xff0000> and the (COLOR_RED_END) by </font>.
Then call the text view setText like this:
setText(Html.fromHtml(convertedString)).

String originalText =  "Hello this is a text in
black color and (COLOR_RED_BEGIN)this is a text in red color.
(COLOR_RED_END)"

String convertedText = replacePlaceHolders(originalText);
textView.setText(Html.fromHtml(convertedString)).

Thanks to all for the non help. Taking into account the bad Android
documentation
I managed to do it.

On 10 mayo, 18:04, ArgBat <[email protected]> wrote:
> Hi all,
>
>   I want to change the color of a substring while it is drawed in a
> text view. For example, if I have this text: "Hello this is a text in
> black color and (COLOR_RED_BEGIN)this is a text in red color.
> (COLOR_RED_END)", then when the text view draws the text the substring
> "this is a text in red color." must be drawn in red.
>
>   Is there a class that I can use for it or must be implemented?
>
> Regards.
>
> --
> 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 
> athttp://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 [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