You can try the html way to styling

This used to work for me.

string ="<font color='#ff0000' > <b>hello</b> </font>"

textview.setText(Html.fromHtml(string))


On Sun, Apr 18, 2010 at 1:17 AM, patbenatar <[email protected]> wrote:

> Sorry, bolding and italicizing is the extent of my text formatting
> knowledge with Android.
>
> Anyone else know more about this?
>
>
>
>
>
>
> On Apr 17, 5:33 am, Sebastian Müller <[email protected]> wrote:
> > Thanks a lot for your answer. This works great for the Bold thing, but
> > background isnt changing...do you know why??
> >
> > my Code:
> >
> > if (index >= 0) {
> >           Spannable str = (Spannable) chapterResult.getText();
> >            str.setSpan(new BackgroundColorSpan(0xFF0000), index, index +
> > searchQuery.getAll().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
> >            str.setSpan(new StyleSpan(android.graphics.Typeface.BOLD),
> index,
> > index + searchQuery.getAll().length(),
> Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
> >
> > }
> >
> > --
> > 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]<android-developers%[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]<android-developers%[email protected]>
> 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 [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