Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make textview's content with both bold and regular text

I'm using a textview to hold a string coming from a web service. String comes with a format like this. "sample text {{b}}bold text{{/b}} and so on". I need to show the bold text bold in my textview. in a single operation I just can pass the string. Do I have a chance to use a string with color, font, etc properties?

Note: I don t have problems with parsing the text I just want to find a way to pass my parsed text to textview.

Thanks

like image 944
ikbal Avatar asked Dec 04 '22 22:12

ikbal


1 Answers

When you set the text in your text view then use:

mytextview.setText(Html.fromHtml(sourceString));

then you will get the text in actual format.

like image 106
Mohit Verma Avatar answered Jan 07 '23 14:01

Mohit Verma