有谁知道如何让EditText控件显示html格式的文本,甚至编写HTML格式的文本,像一个HTML编辑框一样,
Does any one know how to make an EditText control shows html formatted text, and even writes HTML formatted text, to act like an HTML Edit Box,
要在 EditText 中显示 HTML 代码,您需要使用 Html 将其转换为 .在此方法中只能使用一个小的 HTML 标记子集.您可以将 Spanned.fromHtml()Spanned 设置为 EditText 的文本.然后你可以编辑它并使用 Html.toHtml() 将其转换回来.
To show HTML code in an EditText you need to convert it to Spanned using Html.fromHtml(). Only a small HTML tag subset can be used in this method. You can set a Spanned as a text of an EditText. Then you can edit it and convert it back using Html.toHtml().
这篇关于使 EditText 接受并显示 HTML 格式的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在android中剪切、复制、粘贴Cut, copy, paste in android(在android中剪切、复制、粘贴)
android EditText 融入背景android EditText blends into background(android EditText 融入背景)
更改 EditText 的线条颜色 - AndroidChange Line Color of EditText - Android(更改 EditText 的线条颜色 - Android)
EditText 始终显示带 2 位小数的数字EditText showing numbers with 2 decimals at all times(EditText 始终显示带 2 位小数的数字)
更改光标在展开的 EditText 中的开始位置Changing where cursor starts in an expanded EditText(更改光标在展开的 EditText 中的开始位置)
android中的EditText,adjustPan,ScrollView问题EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView问题)