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中的文本?