以编程方式隐藏/显示Android软键盘不工作Api 16在gretherthen工作16

时间:2016-01-22 05:07:29

标签: android

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.showSoftInput(Search_client,
                        InputMethodManager.SHOW_IMPLICIT);

1 个答案:

答案 0 :(得分:0)

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

显示键盘

public void ShowKeyboard(View view){
 imm.showSoftInput(view.getWindowToken(), InputMethodManager.SHOW_IMPLICIT);
}

隐藏键盘

public void HideKeyboard(View view){
     imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
    }