1.在Activity中,EditText 无法自动弹出软键盘,可以在尝试在AndroidManifest中设置android:windowSoftInputMode=adjustResize
也可以
edit.setFocusable(true);
edit.setFocusableInTouchMode="true"
edit.requestFocus();
2.在Fragment中,设置会失效,可以尝试在Fragment中强制启动
public void forceOpenSoftKeyboard(Context context)
{
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
}
//然后放在oncreateView中,让View布局绘制完后就执行
onCreateView()
{
//………………………………………
forceOpenSoftKeyboard(getActivity());
}