为什么我只得到字符串的一部分,当我在Kotlin中使用getString ?



我在资源文件中保存了一个字符串,我运行代码a并得到结果a,我希望得到结果b

我的代码有什么问题?

结果

Recommend the app to a friend

代码

val context = LocalContext.current
val temp=context.getString(R.string.myRecommendContent)

<string name="myRecommendContent"><a href="#">Recommend</a> the app to a friend</string>

结果B

<a href="#">Recommend</a> the app to a friend

我知道这是downvoted和所有,但你试过:

<string name="myRecommendContent">&lt;a href=&quot;#&quot;&gt;Recommend&lt;/a&gt; the app to a friend</string>

在我看来,它忽略了你的"其他"。元素,例如anchor元素,然后继续使用string元素本身。

最新更新