简体   繁体   中英

String returns tags and not formatted text

Code:

StringBuilder sb = new StringBuilder();
sb.append(String.format("<b>%s. %s</b> %s", Integer.toString(id), name, description));
derp.setText(sb.toString());

Returns:

< b>id. name< /b> description

Wanted outcome:

id. name description

尝试以下方法:

derp.setText(Html.fromHtml(sb.toString()));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM