Lis*_*nne 30 android ime android-softkeyboard
我尝试使用input.setImeOptions(EditorInfo.IME_ACTION_DONE)在软键盘上设置"完成"按钮;
但"完成"按钮根本不会显示在软键盘上.
有什么建议吗?
public void modif(int position) {
AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
alert.setTitle("Modifica");
EditText input = new EditText(MainActivity.this);
input.setImeOptions(EditorInfo.IME_ACTION_DONE);
alert.setView(input);
final Editable value = input.getText();
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
Toast.makeText(getApplicationContext(), value, Toast.LENGTH_LONG).show();
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();
}
Run Code Online (Sandbox Code Playgroud)
sda*_*bet 61
这可能是因为您的输入字段不是单行的.
尝试添加
input.setSingleLine();
Run Code Online (Sandbox Code Playgroud)
您将看到按下键盘的操作键实际上会执行"完成"操作(即关闭键盘)
请参阅http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#IME_ACTION_DONE
| 归档时间: |
|
| 查看次数: |
19452 次 |
| 最近记录: |