为什么我不能将文本设置为 Android TextView? [英] Why can't I set text to an Android TextView?
本文介绍了为什么我不能将文本设置为 Android TextView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在将文本设置为 TextView 时遇到问题:
I'm having a problem with setting text to a TextView:
TextView android:editable = "true".
在我的 .java 中,这似乎应该可行:
In my .java it seems like that this should work:
text = (EditText) findViewById(R.id.this_is_the_id_of_textview);
text.setText("TEST");
但事实并非如此.谁能告诉我这里出了什么问题?
But it doesn't. Can anyone tell me what's wrong here?
推荐答案
在您的 java 类中,将EditText
"类型设置为TextView
".因为你已经在 layout.xml
文件中声明了一个 TextView
In your java class, set the "EditText
" Type to "TextView
". Because you have declared a TextView
in the layout.xml
file
这篇关于为什么我不能将文本设置为 Android TextView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文