问题描述
你可以使用这个 onResume:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(((EditText) findViewById(R.id.your_view)),InputMethodManager.SHOW_FORCED);
隐藏:
((InputMethodManager) YourActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(findViewById(R.id.YOUR_VIEW).getwindowToken(), 0);
试试这个:
getwindow().setSoftInputMode(WindowManager.LayoutParams.soFT_INPUT_STATE_ALWAYS_VISIBLE);
解决方法
我有一个只有 EditText 的活动。我希望软键盘自动显示。我怎样才能做到这一点?