2010년 4월 1일 목요일

soft keyboard 관련

[키보드 보이기]
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, 0);

[키보드 숨기기]
 InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, 0);


InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getWindowToken(), 0);

[Done Key or Enter Key Press 확인]
edt = (EditText)findViewById(R.id.edittext);
        edt.setOnEditorActionListener(new OnEditorActionListener(){
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
// TODO Auto-generated method stub
if ((actionId == EditorInfo.IME_ACTION_DONE) || // Virtual KeyPad의 Done key
(event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
Toast.makeText(ListExample.this, "Done Key or Enter key Press", Toast.LENGTH_SHORT).show();
 }
return false;
}
        });

댓글 없음:

댓글 쓰기