Ackman Ackman - 1 year ago 91
Java Question

TextView make part of text not bold

I have a TextView title. I need it showing half of text bold and other half not bold. The way I set it is shown below:

category.getName() -- > Bold
"urinary tract infection" ---->not bold

title.setText(category.getName()+ "\n(urinary tract infection)");

How do I achieve this?

Answer Source

You can try formatting you TextView using HTML.

title.setText(Html.fromHtml("<b>"+category.getName()+ "</b>\n(urinary tract infection)"));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download