android.content.res.Resources$NotFoundException: String resource ID #0x

遇到这个错误:

android.content.res.Resources$NotFoundException: String resource ID #0x

查了一下,是因为,调用setText()方法时,传入的int值,会被当成resourceID来使用,

改成 btn.setText(1+"")就可以了。

把int强转成string就能当成内容显示啦

猜你喜欢

转载自blog.csdn.net/hpp_1225/article/details/80734991