0
当用户单击操作栏中的图标时,AlertDialog将打开以保存数据。 要输入文件的名称,将出现一个软键盘。在这个键盘上,我想改变一个完成的ENTER按钮。我申请了“.setImeOptions(EditorInfo.IME_ACTION_DONE);”但它不起作用。这是我的AlertDialog代码:在软键盘上更改下一个按钮完成按钮不起作用
公共无效openSaveBox(){
final AlertDialog ad = new AlertDialog.Builder(this).create();
ad.setTitle("OCRA score bewaren");
ad.setMessage("Geef een bestandsnaam in:");
final EditText input = new EditText(this);
ad.setView(input);
ad.setButton2("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String file = input.getText().toString();
bewaren(file);
ad.dismiss();
}
});
ad.setButton("Annuleren", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
ad.dismiss();
}
});
ad.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
input.setImeOptions(EditorInfo.IME_ACTION_DONE);
ad.show();
}
我在做什么错?
它完美工作之前,设置
InputType
为编辑文本输入。感谢Colns Abt! –@Michael_D如果它有效,你应该接受答案 – kingston