Android 软键盘小知识点

时间:2021-08-27 06:55:56
chatText = (EditText) findViewById(R.id.chatText);
chatText.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
return sendChatMessage();
            //监听软键盘的状态,执行相应的方法.......
}
return false;
}
});