也许是一个简单的问题 - 我需要帮助从我的 strings.xml 中设置多个字符串。 mytext.setText(resources.getString(R.string.history_text1+R.string.history_text2));所以我的意思是我需要通过一个 setText 将 2 个不同的文本作为一个文本。但是使用这种语法我有一个错误:android.content.res.Resources$NotFoundException: String resource ID #0xfe1e0079
2 回答

宝慕林4294392
TA贡献2021条经验 获得超8个赞
尝试这个:
mytext.setText(resources.getString(R.string.history_text1) + resources.getString(R.string.history_text2))

叮当猫咪
TA贡献1776条经验 获得超12个赞
值:R.string.history_text1
和R.string.history_text2
是引用资源中实际字符串的整数。
通过添加它们,您会得到另一个不引用任何内容的整数,因此您会得到:
Resources$NotFoundException
如果要连接 2 个字符串值:
String value = resources.getString(R.string.history_text1) + resources.getString(R.string.history_text2) mytext.setText(value);
添加回答
举报
0/150
提交
取消