Android开发经验谈Android知识Android技术知识

Android AlertDialog 无法弹出输入法

2016-08-09  本文已影响1190人  HarryXR

可能很多人都遇到这种问题,点击dialog的输入框无法弹出输入法,我就说说自己的解决方法

final AlertDialog dialog = new AlertDialog.Builder(this).create(); dialog.show();
 dialog.setCanceledOnTouchOutside(false);
 dialog.setCancelable(true); 
View v = View.inflate(this, R.layout.dialog_del_order, null); 
dialog.getWindow().setContentView(v);

这是直接设置 当前window的view,无需再自定义Dialog

dialog.getWindow().clearFlags( 
        WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | 
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); 

//弹出输入法

dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
上一篇 下一篇

猜你喜欢

热点阅读