Android里边自定义的dialog点击EditText时为什么不能显示软键盘? 代码如下,他得软件盘不在当前页面....:
finalAlertDialogupdatedialog=newAlertDialog.Builder(this).create();updatedialog.reque...
final AlertDialog updatedialog=new AlertDialog.Builder(this).create();
updatedialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
updatedialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//显示软键盘
LayoutInflater factory=LayoutInflater.from(this);
View view=factory.inflate(R.layout.update_password_dialog, null);
view.findFocus();
updatedialog.show();
//显示修改密码布局文件
updatedialog.getWindow().setContentView(view);
//设置软键盘
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
InputMethodManager imm=(InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.showSoftInput(view, 0);
imm.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS); 展开
updatedialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
updatedialog.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//显示软键盘
LayoutInflater factory=LayoutInflater.from(this);
View view=factory.inflate(R.layout.update_password_dialog, null);
view.findFocus();
updatedialog.show();
//显示修改密码布局文件
updatedialog.getWindow().setContentView(view);
//设置软键盘
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
InputMethodManager imm=(InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.showSoftInput(view, 0);
imm.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询