尚未输入任何内容时,禁用键盘的发送按钮[Android] [英] Disabling the keyboard's send button when nothing has been typed yet [Android]

查看:121
本文介绍了尚未输入任何内容时,禁用键盘的发送按钮[Android]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在android应用程序中创建搜索选项.

I'm creating a search option in an android application.

屏幕键盘上按搜索"后,将触发一个事件,该事件将查询发送到服务器. 我想做的是,在尚未输入相应EditText的文本时,禁用屏幕键盘上的搜索"按钮.

After pressing "Search" on the screen-keyboard an event triggers which sends the query to the server. What I want to do is disable the "Search" button on the screen-keyboard when no text has been typed in it's corresponding EditText yet.

我将此添加到了EditText:

android:imeOptions="actionSearch"

所以这就是键盘上有一个搜索"按钮而不是默认的输入"/完成"的原因. (以防万一,你想知道).

So that's why the keyboard has got a "Search" button in stead of the default "enter"/"done". (Just in case you where wondering).

推荐答案

我们无法禁用android键盘上的操作按钮.您将不得不检查在编辑器操作侦听器中是否为空字符串.

We cannot disable the action button on the android keyboard. You will have to settle with checking for empty string in editor action listener.

这篇关于尚未输入任何内容时,禁用键盘的发送按钮[Android]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆