[英]Changing next button to done button on soft keyboard doesn't work
當用戶單擊操作欄中的圖標時,將打開AlertDialog來保存數據。 要輸入文件名,將出現一個軟鍵盤。 在此鍵盤上,我想用“完成”更改“輸入”按鈕。 我套用了“ .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
之前設置InputType
輸入的ImeOptions
即
input.setInputType(EditorInfo.TYPE_CLASS_TEXT);
input.setImeOptions(EditorInfo.IME_ACTION_DONE);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.