我的数据库中有一些 html 条目,我想将它们呈现为 HTML 而不是普通文本
下面是我的那个 Activity 的java代码 我正在从 firebase 检索数据 我的数据库中的内容是这样的
<a href='google.com' target='_Blank'> Click Here </a>
我希望它能像正常的 html 一样转换和显示
find code here https://pastebin.com/raw/9KdiEEx4
编辑:
我要这个
<a href='google.com' target='_Blank'> Click Here </a>
变成这样
<a href='google.com' target='_Blank'> Click Here </a>
& 显示为正常的 html
我的java代码在上面 请帮助我
最佳答案
Android 版 < Nougat :
textView.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>"));
Android 版本 >= Nougat:
textView.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>", Html.FROM_HTML_MODE_COMPACT));
关于java - 启用 html 的 android ListView ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48285684/