textView.setText(Html.fromHtml(myString),
TextView.BufferType.SPANNABLE);
Spanned marked_up = Html.fromHtml(myString); textview.setText(marked_up.toString(),BufferType.SPANNABLE);
String styledText = "This is <font color='red'>simple</font>."; textView.setText(Html.fromHtml(styledText), TextView.BufferType.SPANNABLE);
WebView webview = new WebView(this); String summary = "<html><body>Sorry, <span style=\"background: red;\">Madonna</span>
gave no results</body></html>"; webview.loadData(summary, "text/html", "utf-8");
textView.setText(Html.fromHtml("this is <u>underlined</u> text"));
You can use UnderlineSpan from SpannableString
class:
SpannableString content = new SpannableString(<your text>); content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
Then just use
textView.setText(content);
myTextView.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>"));
Không có nhận xét nào:
Đăng nhận xét