使用新的 data binding library对于 Android,我可以仅通过 XML 为 TextView
使用 HTML 格式,还是必须以编程方式使用 Html.fromHtml
?
最佳答案
您必须导入 Html 然后调用 fromHtml 方法:
<data>
<import type="android.text.Html"/>
</data>
…
<TextView
android:text="@{Html.fromHtml(@string/my_html)}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
关于android - Android 新数据绑定(bind)库中的 HTML 格式化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31778414/