0

我的应用程序能够在 textview 中显示简短的 HTML 源代码。但是,对于较长的 HTML 源代码,它就是行不通的。HTML 在 Web 浏览器中正确显示。

示例 HTML:

<font color='#26D4CB' /><u>Title</u></font><br>Text<br><br><font color='#26D4CB' /><u>Title Title Title Title Title Title</u></font><br>some long text some long text some long text some long text <br><br><font color='#26D4CB' /><u>Title Title Title Title Title Title</u></font><br><br><font color='#26D4CB' /><u>Title Title Title Title Title Title</u></font><br>+ rework of the emoji picker<br>some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text 

我同时使用

tvChangelog.setText(Html.fromHtml(changelog),TextView.BufferType.SPANNABLE);

tvChangelog.setText(Html.fromHtml(changelog));

然而两者都没有取得任何成果。任何想法?

4

1 回答 1

0

您的 HTML 似乎不正确(尤其是<font>元素)。尝试将其替换为以下内容:

<font color='#26D4CB'><u>Title</u></font><br>Text<br><br><font color='#26D4CB'><u>Title Title Title Title Title Title</u></font><br>some long text some long text some long text some long text <br><br><font color='#26D4CB'><u>Title Title Title Title Title Title</u></font><br><br><font color='#26D4CB'><u>Title Title Title Title Title Title</u></font><br>+ rework of the emoji picker<br>some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text</u></font>
于 2012-11-14T09:12:38.700 回答