0

我想要弹出inputmethodservice中的alertdialog我已经在alertdialog中弹出一个编辑文本,但它没有发生编辑文本焦点请帮帮我在输入法服务警报对话框不集中在edittext

`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

正如你已经提到requestfocus(),只是尝试添加下面的行,并尝试一次..因为它为我工作。

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