[英]Android: String from SQLite can not be set as HTML in Textview
Hi I have an response from backend API with HTML string format, and I put into textview as HTML in android using: 嗨,我收到了来自后端API的HTML字符串格式的响应,并且在Android中使用HTML将textview放入HTML中,使用:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
sinopsis.setText(Html.fromHtml(summaryText, Html.FROM_HTML_MODE_COMPACT));
}else{
sinopsis.setText(Html.fromHtml(summaryText));
}
The problem is: 问题是:
If I put response from API direct into Textview the result is correct show as HTML parsed like <br/>,
如果我将来自API的响应直接输入到Textview中,则结果可以正确显示为HTML,如<br/>,
tags not shown as html code 标签未显示为html代码
Hi this is example from API response
Thanks
but if I save the result into SQLite as string and get in to Textview shown as pure html code 但是如果我将结果保存为字符串形式的SQLite并进入显示为纯HTML代码的Textview
Hi this is example from API response <br />Thanks
I no idea to solve this case, anyone can help me please. 我不知道要解决此案,任何人都可以帮助我。
solved: I translated some html into string function in Android like 解决:我将一些html转换为Android中的字符串函数,例如
into \\n 进入\\ n
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.