[英]Images in android textview using fromHtml method doesn't show up
[英]Android show HTML on TextView method fromHtml
我正在嘗試在textview中顯示HTML。 我找到此頁面 ,並說要使用.fromHtml。 嘗試使用時出現錯誤
TextView tvAbout = (TextView) window.findViewById(R.id.tvAbout);
Spanned about_text = Html.fromHtml(R.string.about_text);
tvAbout.setText(about_text);
Eclipse建議我使用toHtml
。 當我這樣做時,建議我使用fromHtml
。 有什么建議嗎?
嘗試這個..
從string.xml
獲取之前使用getString
Spanned about_text = Html.fromHtml(getString(R.string.about_text));
Html.fromHtml
需要一個字符串參數,而您提供的“ R.string.about_text”參數是一個整數ID。 多數民眾贊成在您的錯誤原因。
因此,請按照Hariharan的答案進行更正,以從該ID中獲取文本。
getString(R.string.about_text)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.