String = " This is SAMPLE"
I want to increase the size of the SAMPLE alone in String to highlight, but need to be in a single string, this is to set in TextView.
Thanks in Advance.
textView.setText(Html.fromHtml("This is <font color='#707070' size='20'>
SAMPLE</font>"));
Try this:
String str = "This is <b>SAMPLE</b>";
yourTextView.setText(Html.fromHtml(str), BufferType.SPANNABLE);
Moreover, you may decorate your string (str) with html tags to alter the looks.
Or to highlight a part of text without using html stuff, read this
Use Html.fromHtml()
in setText()
of TextView
. Supported Html Tags can be found here Html Tags Supported by TextView
I think this is possible if you pass the text as html with your highlighted part enclosed in html <bold>
tag.
You have two options:
1, Format your string in HTML and use HTML.from("Your text");
2, Use spannable. A complete guide can find link here