简体   繁体   English

如何在EditText中更改文本

[英]How to change text in EditText

我是Android开发的新手,已经能够通过XML代码设置EditText元素的文本,但是如何在代码中进行设置呢?

Simply call the setText() method. 只需调用setText()方法。 Here is an example: 这是一个例子:

EditText e = (EditText) findViewById(R.id.editText);
e.setText("New Text");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM