You need to use
Html.fromHtml() to use HTML in your XML Strings. For example (< Android Nougat):
myTextView.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>"));
For example (>= Android Nougat):
myTextView.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>", Html.FROM_HTML_MODE_COMPACT));
To differentiate between Android versions use Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
No comments:
Post a Comment