简体   繁体   中英

how to replace the content between the strong tags with bold text in android

I'm parsing html content with the Jsoup library and I want to transform the content between the strong tag in bold text in android; here is my attempt:

paragraph.html().replace("<strong>(.+?)</strong>", new StyleSpan(android.graphics.Typeface.BOLD).toString());

I've already tried to use Html.fromHtml but it doesn't work..

Where am I doing wrong?

I've been able to solve my problem thanks to Rami answer:

String myParagraph = paragraph.html(); 
myParagraph = myParagraph.replace("<strong>", "<strong><b>"); 
myParagraph = myParagraph.replace("</strong>", "</b></strong>"); 
String newString = Html.fromHtml(myParagraph);

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