android - 如何从 api 的 html 标签显示图像?
问题描述
我用过holder.txtTitle.setText(HtmlCompat.fromHtml(dataList.getDescription(), 0));
HtmlCompat.fromHtml 移除标签但不显示图片
如何显示整个图像而不是框?因为 HtmlCompat.fromHtml 没有工作。
提前致谢
HTML 文本(来自 API):
<p>Android is a Linux based operating system it is designed primarily for touch screen mobile devices such as smart phones and tablet computers. The operating system have developed a lot in last 15 years starting from black and white phones to recent smart phones or mini computers. One of the most widely used mobile OS these days is android. The android is software that was founded in Palo Alto of California in 2003.</p>
<p><img alt="" src="http://mapi.trycatchtech.com/uploads/android_tutorials/bf029f4a311b3168e0cfda1a0ef78815.png" style="height:342px; width:500px" /></p>
<p>The android is a powerful operating system and it supports large number of applications in Smartphones. These applications are more comfortable and advanced for the users. The hardware that supports android software is based on ARM architecture platform. The android is an open source operating system means that it’s free and any one can use it. The android has got millions of apps available that can help you managing your life one or other way and it is available low cost in market at that reasons android is very popular.</p>
<p><img alt="" src="http://mapi.trycatchtech.com/uploads/android_tutorials/666b3ec86e308cd3e7f6bb1d12bb06f2.png" style="height:316px; width:508px" /></p>
<p>The android development supports with the full java programming language. Even other packages that are API and JSE are not supported. The first version 1.0 of android development kit (SDK) was released in 2008 and latest updated version is jelly bean.</p>
解决方案
您无法在TextView
. 让它WebView
。然后像这样加载html文本holder.webview.loadDataWithBaseURL(null,dataList.getDescription(),"text/html","UTF-8","about:blank");
推荐阅读
- php - 是否可以从 stdClass 扩展 CI_Controller / CI_Model
- javascript - 带有 Promise 爬虫 NodeJS 的递归循环
- java - 在 Java 中读取从批处理文件启动的 STDIN
- jenkins - Jenkins 在克隆时显示连接超时
- javascript - 当图像出现时,如何为图像添加过渡效果?
- parsing - 是否可以为解析相应调试格式的任意类型派生解析器?
- java - 将数据字符串拆分为多个变量(Java)
- php - 如何查询我们在 2 个自定义字段中的值之间的坐标?
- ruby-on-rails - 使用 AWS 的 Heroku 上的 TypeError(没有将数组隐式转换为字符串)Rails App
- angular - 从模板访问“this”(组件实例)