轻按"ImeAction搜索"后将其更改为“完成" [英] ImeAction Search is changed to Done after tapping on it
问题描述
我有一个用于在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屋!