轻按"ImeAction搜索"后将其更改为“完成" [英] ImeAction Search is changed to Done after tapping on it

查看:92
本文介绍了轻按"ImeAction搜索"后将其更改为“完成"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于在Listview上搜索的Edittext.

I have an Edittext for searching on Listview.

我已将imeOption设置为'IME_ACTION_SEARCH',以便软键盘将在其上显示搜索键.

I have set imeOption to 'IME_ACTION_SEARCH' so that soft-keyboard will show search key on it.

问题在于,如果edittext中不包含任何文本,那么当我点击键盘上的搜索键时,搜索键将变为完成",而不是关闭键盘.

The problem is that when I tap on search key on keyboard if edittext contains no text in it, the search key changes to 'Done' instead of dismissing the keyboard.

如果Edittext中包含一些文本,则搜索键效果很好.

If the Edittext contains some text in it the search key works well.

推荐答案

我发现了这个问题.发生这种情况是因为OnEditorAction侦听器未在Edittext上正确设置.由于未正确设置侦听器,因此呼叫无法到达onEditorAction()方法.

I found the problem behind this. It was happening because the OnEditorAction Listener was not properly set on Edittext. Since listener was not properly set call was not reaching onEditorAction() method.

这篇关于轻按"ImeAction搜索"后将其更改为“完成"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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