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.
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?
"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
.