Android-android 如何禁用软键盘中的确定键

Android-android 如何禁用软键盘中的确定键

浮生未歇 发布于 2016-10-10 字数 195 浏览 1124 回复 1



需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。


晚风撩人 2017-05-30 1 楼

在 EditText 布局中添加一个 属性 值就可以的说~


google 官方的解释:

These options are controlled with the android:imeOptions attribute on TextView. The value you supply here can be any combination of:

One of the pre-defined action constants (actionGo, actionSearch, actionSend, actionNext, actionDone). If none of these are specified, the system will infer either actionNext or actionDone depending on whether there is a focusable field after this one; you can explicitly force no action with actionNone.
The flagNoEnterAction option tells the IME that the action should not be available on the enter key, even if the text itself is not multi-line. This avoids having unrecoverable actions like (send) that can be accidentally touched by the user while typing.
The flagNoAccessoryAction removes the action button from the text area, leaving more room for text.
The flagNoExtractUi completely removes the text area, allowing the application to be seen behind it

理论上,单纯的只设置 actionNone 其实就可以实现了,加上 flagNoEnterAction 可以防止那些不可挽回的操作,比如发送。

来修改会你需要的状态,只需要 java 代码:


恢复 normal 就 ok 了,祝好