Html.fromHtml 隐藏"<"和">"之间的文本



这是巫师代码

String testText = "<( ̄3 ̄)> &#128517;Σ( ° △ °|||)︴test text&#128544;♪(^∀^●)ノ";
textView.setText(Html.fromHtml(testText));

我在手机屏幕上得到了这些😅Σ( ° △ °|||)︴test text😠♪(^∀^●)ノ.

<( ̄3 ̄)>丢失了。

Html.fromHtml<>标识为标签,因此如果需要显示它们,则需要手动转义它们

String testText = "&lt;( ̄3 ̄)&gt; &#128517;Σ( ° △ °|||)︴test text&#128544;♪(^∀^●)ノ";
t.setText(Html.fromHtml(testText));

注意:&lt;是<符号,&gt;是>符号

最新更新