我正在尝试在inputmethodservice中弹出alertdialog我在alertdialog中有一个编辑文本它正常弹出但编辑文本焦点没有任何反应请帮帮我
`AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Make your selection");
input = new EditText(this);
input.setId(1);
input.requestFocus();
builder.setView(input);
AlertDialog alert = builder.create();
Window window = alert.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.token = mInputView.getWindowToken();
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
alert.show();
}`
有什么东西我不见了吗?
答案 0 :(得分:0)
正如你已经提到的requestfocus(),只是尝试添加以下行并尝试一次。因为它对我有效。
dialog.getWindow()clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);