keyboard when edittext is get focused?
This question already has an answer here:
 Through InputMethodManager you can show and hide the soft keyboard.  Use toggleSoftInput() method to show soft keyboard when EditText get focus and use hideSoftInputFromWindow() to hide the keyboard when EditText lost focus as below...  
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
    @Override
    public void onFocusChange(View v, boolean isFocused) {
        if (isFocused) {
            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
        } else {
            imm.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0); 
        }
    }
});
试用这些代码..
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputMethodManager != null) {
    inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
上一篇: 在android中禁用EditText
下一篇: 键盘edittext时得到专注?
