public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/* 取得TextView、EditText */
mTextView01 = (TextView) findViewById(R.id.myTextView);
mEditText01 = (EditText) findViewById(R.id.myEditText);
/* 设置EditText 用OnKeyListener 事件来启动 */
mEditText01.setOnKeyListener(new EditText.OnKeyListener(){
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
mTextView01.setText(mEditText01.getText().toString());
return false;
}
});
}
转载于:https://www.cnblogs.com/hao222/p/3487497.html