2012-11-14 43 views
0

我的應用程序能夠在textview中顯示簡短的HTML源代碼。但是,對於長的HTML源代碼,它不起作用。 HTML在網頁瀏覽器中正確顯示。Textview中的長HTML源碼

示例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

嗯..這似乎爲我工作..你會得到什麼樣的意外結果? – fiddler

+0

真的嗎?我只有
才能工作。然而,顏色從未改變。 – MrYanDao

回答

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>