1

Why the text is not bold and italic as I wrote? Here is my values string xml code:

 <string name="fragrance"> <b>FirstItem</b> \n<i>Description</i> </string>

enter image description here

Julia
  • 61
  • 2
  • 8

1 Answers1

1

You have to set it by this way:

Spanned htmlString = Html.fromHtml(getString(R.string.fragrance));
textView.setText(htmlString);
Ikazuchi
  • 433
  • 2
  • 12
  • I have a class MyItem. It needs only String, I can't pass a html string to it. myitems.add(new MyItem(getString(R.string.fragrance),false)); – Julia Jul 11 '18 at 08:43
  • Ok, you can store it as string value in MyItem, but you have to use it next as spanned to add it to textview. – Ikazuchi Jul 11 '18 at 10:04