Android 如何禁用 EditText 软件键盘上的“下一步”按钮(替换为“完成”按钮)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2568637/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 06:21:33  来源:igfitidea点击:

How to disable "Next" button on a EditText software keyboard (replace with "Done" button)

androidandroid-edittextsoft-keyboard

提问by Andrew Buss

I have a bunch of EditTexts in my Android application, each with InputMethod set to numberSigned. My target device does not have a hardware keyboard and uses the software keyboard for numeric entry. Android replaces the standard "Done" button to the right of the entry box with a "Next" button. How can I use "Done" instead?

我的 Android 应用程序中有一堆 EditText,每个都将 InputMethod 设置为 numberSigned。我的目标设备没有硬件键盘,而是使用软件键盘输入数字。Android 将输入框右侧的标准“完成”按钮替换为“下一步”按钮。我该如何使用“完成”?

回答by Jim Blackler

Try adding android:imeOptions="actionDone"to your EditText.

尝试添加android:imeOptions="actionDone"到您的EditText.

Reference

参考

回答by tomwhipple

This can also be accomplished in code with:

这也可以在代码中完成:

myEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);