Android TextView Html.fromHtml 和使用SpannableString哪一个效率更高
高洛峰
高洛峰 2017-04-17 15:53:57
0
3
449
高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
大家讲道理

What is the "efficiency" you want? The total parse time is short? The time until the first screen content is displayed is short (this HTML.fromHTML is not good)? Or something else?


Is there any other way to make TextView have different display effects (like SpannableString)?

"Yes", you can always rewrite a set of strings that can express similar semantics and match it with your own TextView.

But considering that the text that can be displayed simultaneously on a mobile phone is quite limited, I think Spannable (this series is already quite refined) will not become a bottleneck.

大家讲道理

If the html content is large and complex, consider using WebView, but you still have to meet actual needs. In terms of efficiency, I think there shouldn't be much difference between the two.

左手右手慢动作

Html.fromHtml 适合做一些简单的样式设置,如字体大小,字体颜色。
但如果涉及到文本的部分可点击,部分字体不同。那就要用到SpannableString.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!