final TextView textView = (TextView) findViewById(R.id.textView);
final EditText editText = (EditText) findViewById(R.id.editText);
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String etString = editText.getText().toString();
textView.setText(etString);
}
});
我是新来的编码,我不知道如何自动清除EditText中的文本,所以用户不必自己做。您可以在所有“大型”网站上看到,当您在文本框中输入文本时(例如:“您叫什么名字?”),您会在文本框中看到“名字”,当您点击它时,它会消失。如何让文本自动消失而用户不必手动删除它?如何自动清除EditText中的文本?