/**

 * 

 * @MethodName:closeInputMethod

 * @Description:关闭系统软键盘

 * @throws

 */

public void closeInputMethod(){

try {

((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))

.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),

InputMethodManager.HIDE_NOT_ALWAYS);

catch (Exception e) { }finally{ }

}

/**

 * 

 * @MethodName:openInputMethod

 * @Description:打开系统软键盘

 * @throws

 */

public void openInputMethod(final EditText editText){

Timer timer = new Timer();

timer.schedule(new TimerTask() {

public void run() {

InputMethodManager inputManager = (InputMethodManager) editText

.getContext().getSystemService(

Context.INPUT_METHOD_SERVICE);

inputManager.showSoftInput(editText, 0);

}

}, 200);

}

相关文章:

  • 2021-08-06
  • 2021-09-08
  • 2021-09-08
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
相关资源
相似解决方案