Back

native android app 中 显示 (使用) html

发布时间: 2014-11-23 08:09:00

refer to http://developer.android.com/reference/android/text/Html.html#fromHtml%28java.lang.String%29

Class Overview
This class processes HTML strings into displayable styled text. Not all HTML tags are supported.

也就是说,可以处理大部分的HTML内容. 我已经很欣慰了.

and refer to:  http://stackoverflow.com/questions/2116162/how-to-display-html-in-textview

You need to use Html.fromHtml() to use HTML in your XML Strings. Simply referencing a String with HTML in your layout XML will not work.

For example:

myTextView.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>"));

Back