gpt4 book ai didi

android - setImeOptions : why the "Done" button does not show on the soft keyboard?

转载 作者:IT老高 更新时间:2023-10-28 21:51:02 26 4
gpt4 key购买 nike

我尝试使用 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();
}

最佳答案

这可能是因为您的输入字段不是单行的。

尝试添加

input.setSingleLine();

您会看到按下键盘的操作键实际上会执行“完成”操作(即关闭键盘)

http://developer.android.com/reference/android/view/inputmethod/EditorInfo.html#IME_ACTION_DONE

关于android - setImeOptions : why the "Done" button does not show on the soft keyboard?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13561808/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com