3
我有純文本數據,按照間隔行等格式化。但我想將此文本顯示爲HTML?如何才能做到這一點。需要在HTML webview中顯示文本格式的數據,如堆棧溢出
[American Thinker]
March 1, 2016
[American Thinker] [Navigation Menu]
HomeArchivesVideoCartoonsAboutSearchLoginRules/FAQContactDonations
Merchandise <http://www.americanmethod.com/american-thinker/>
Home Archives Video Cartoons About Search Login More [Down Arrow]
* Rules/FAQ
* Contact
* Donations
* Merchandise <http://www.americanmethod.com/american-thinker/>
American Thinker Blog
Mexican oil giant devastated by oil price decline - 3/1/16 March 1, 2016
The state owned oil company that provides one third of the revenue of the
Mexican government is in a deep crisis, owing to low oil prices,
我想顯示就像它出現在網絡上的stackoverflow上。
問題是,當我把它放在一個段落時,它看起來全部串在一起。
支持相反的操作Html.fromHtml(htmlString),但是如何將文本轉換爲在HTML中正確顯示的內容?在我發佈之前沒有想過它,但真的希望它看起來就像這個編輯文本。
UPDATE:
<PRE> </PRE>
做一些我想要的東西,但現在包裝不會發生這樣有向右或向左滾動。
UPDATE:添加按建議下面我現在得到一句包裝,但有些線路如下所示:
The state owned oil company that
provides one third of the revenue of
the
Mexican government is in a deep crisis,
owing to low oil prices,
inefficiency, and corruption. The
implications for the United States are
important. More
The Calamitous Climate at
etc etc
這裏是我的html:
String htmlstuff = " \n" +
"<html>\n" +
"<header><title>This is title</title></header>\n" +
"<body>\n" +
"<pre style=\"white-space: pre-wrap;\">\n";
htmlstuff=htmlstuff+result;
htmlstuff=htmlstuff+
" </pre>\n"+
"</body>\n" +
"</html>\n";
wv.loadDataWithBaseURL("", htmlstuff, "text/html", "UTF-8", "");
wv.setHorizontalScrollBarEnabled(false);
我會嘗試它沒有正確包裝。讓我看看。只需一秒 – FunctionallyReactive
它是一個巨大的改進,現在包裝。我更新了以上我現在看到我的帖子! – FunctionallyReactive
直到現在我看不到任何更新,你能在這裏解釋你的問題嗎? –