简体   繁体   中英

Html.fromHtml or Spannable,what is best?

hello i want change color in my textview, there is two way : Html.fromHtml And Spannable. whats is better? what way is faster?

Html.fromHtml is slower because the full text is parsed as an HTML. It actually involves the conversion from HTML to a text.

Spannable , on the other hand, is a lot more load-free because you just have to attach or detach the markup object . No conversions involved.

Therefore, go with Spannable , it's much faster than the html alternative.

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