开发者

Recommended approach for presenting formatted text in Android?

I am developing an application that will provide instructions to making a product. The text will have bullets and/or numbered steps as well regular text paragraphs. I may have headings for vari开发者_如何学JAVAous sections. The text will be placed into a scrollable TexView.

I was originally planning on loading the text from a resource text file and then applying formatting via xml. However, I just learned about WebView and the ability to load local html files. I could easily format the text in html and load it into a WebView for the various activities.

My question is, is there a performance issue with using WebView vs. TextView? Are there other ways to easily format text for a TextView?

Thanks,


WebView definitely takes longer to load the first time into your process. It also is not designed to go in a ScrollView, since it scrolls itself. OTOH, you get excellent HTML support.

TextView can display limited HTML, converted into a SpannedString via Html.fromHtml(). Here is a blog post where I list the HTML tags supported by the Android 2.1 edition of fromHtml(). Note that these are undocumented, and so the roster of tags may be different in other Android releases.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜