【发布时间】:2015-05-27 13:34:54
【问题描述】:
在我的 strings.xml 中:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="informations_links">Read these <b><a href=\"com.android.mobile://ReaderActivity\">general informations</a></b> and <a href=\"com.android.mobile://ReaderActivity\">this main note</a> from this box.</string>
</resources>
那我就这样用了:
mTextView.setText(Html.fromHtml(getString(R.string.informations_links)));
它不起作用。我的文本没有格式化。
但如果我直接写这个并且它可以工作(它是 same 字符串):
mTextView.setText(Html.fromHtml("Read these <b><a href=\"com.android.mobile://ReaderActivity\">general informations</a></b> and <a href=\"com.android.mobile://ReaderActivity\">this main note</a> from this box."));
那么,我的 strings.xml 中最好的写法是什么?
【问题讨论】: