我的应用可以在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));
但两者都没有取得任何成果。有什么想法吗?
答案 0 :(得分: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>