gpt4 book ai didi

java - 以编程方式在 TextView 中设置文本的正确方法

转载 作者:行者123 更新时间:2023-12-01 16:45:48 24 4
gpt4 key购买 nike

这是以编程方式在 TextView 中设置文本的正确方法吗?

points_txt.setText(R.string.you_have + current_points + R.string.points);`

它向我显示了该字符串的 ResourcesNotFoundException 错误,而我可以在 strings.xml 文件中看到该字符串。

最佳答案

points_txt.setText(getResources().getString(R.string.you_have) + current_points + getResources().getString(R.string.points));

关于java - 以编程方式在 TextView 中设置文本的正确方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51409665/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com