Android:Html.fromHtml()方法奇怪的问题

Pra*_*hat 4 android textview

我面临一个奇怪的问题:

我的Html.fromHtml()源代码如下:

<strong>Terrible experience with Nikko hotel</strong><br />It was not easy to cancel booking. I called to cancel books, but they still chraged us two full days. A reason was we were late ten minutes in calling to cancel. They explained us very kindly that I can only cancel the first day. But they charged after then.\nSick."
Run Code Online (Sandbox Code Playgroud)

这是从json响应中检索的

现在,当我使用setText显示它时,如下所示:

commentbox.setText(Html.fromHtml(cmnt.getString("cmnt")));
Run Code Online (Sandbox Code Playgroud)

但我看到的输出如下:

在此输入图像描述

为什么它给我斜体文字而不是粗体?

Han*_*nry 8

这可能是一个限制的描述在这里:

Android中的Html.fromHtml()方法从HTML源代码创建一个SpannedString 翻转<em> and <strong>标签,因此您可能习惯以粗体显示的内容变为斜体,反之亦然.如果您在TextView中显示生成的HTML,这应该只是一个问题 - 特别是WebView应该表现得更正常.