简体   繁体   中英

How to change text in EditText

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

Simply call the setText() method. Here is an example:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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