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 various 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,
Using the styles.xml file You may set a style for your TextViews in the styles. xml file and then use that style whenever you require a TextView. As an example, consider the following: XML.
In Android, TextView displays text to the user and optionally allows them to edit it programmatically. TextView is a complete text editor, however basic class is configured to not allow editing but we can edit it. View is the parent class of TextView.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With