调用下面代码:(第一次调用显示,再次调用则隐藏,如此反复),this指activity InputMethodManager imm = (InputMethodManager)this.getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); imm.showSoftInput(myview, InputMethodManager.SHOW_IMPLICIT); 单独显示隐藏软键盘: 显示: InputMethodManager imm = (InputMethodManager)this.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(myview, 0); 隐藏: imm.hideSoftInputFromWindow(view.getWindowToken(), 0); 程序启动后,自动弹出软键盘,可以通过设置一个时间函数来实现,不能再onCreate里写: Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { InputMethodManager imm = (InputMethodManager)this.getSystemService(INPUT_METHOD_SERVICE); imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); Toast.makeText(chick.this, "show", Toast.LENGTH_SHORT).show(); } }, 1000);