相关疑难解决方法(0)

如何在TextView中显示HTML?

我有简单的HTML:

<h2>Title</h2><br>
<p>description here</p>
Run Code Online (Sandbox Code Playgroud)

我想在其中显示HTML样式的文本TextView.这该怎么做?

html android textview xml-parsing

730
推荐指数
17
解决办法
55万
查看次数

Html List标签在android textview中不起作用.我能做什么?

Html List标签在android TextView中不起作用.这是我的字符串内容:

String str="A dressy take on classic gingham in a soft, textured weave of stripes that resembles twill.  Take a closer look at this one.<ul><li>Trim, tailored fit for a bespoke feel</li><li>Medium spread collar, one-button mitered barrel cuffs</li><li>Applied placket with genuine mother-of-pearl buttons</li><li>;Split back yoke, rear side pleats</li><li>Made in the U.S.A. of 100% imported cotton.</li></ul>";
Run Code Online (Sandbox Code Playgroud)

我在这样的文本视图中加载它:

textview.setText(Html.fromHtml(str));
Run Code Online (Sandbox Code Playgroud)

输出看起来像一个段落.我能做什么?它有什么解决方案吗?

编辑:

webview.loadData(str,"text/html","utf-8");
Run Code Online (Sandbox Code Playgroud)

android

95
推荐指数
8
解决办法
6万
查看次数

标签 统计

android ×2

html ×1

textview ×1

xml-parsing ×1