Most visited

Recently visited

Added in API level 11

SearchView.OnQueryTextListener

public static interface SearchView.OnQueryTextListener

android.widget.SearchView.OnQueryTextListener


对查询文本进行更改的回调。

Summary

Public methods

abstract boolean onQueryTextChange(String newText)

当查询文本被用户更改时调用。

abstract boolean onQueryTextSubmit(String query)

当用户提交查询时调用。

Public methods

onQueryTextChange

Added in API level 11
boolean onQueryTextChange (String newText)

当查询文本被用户更改时调用。

Parameters
newText String: the new content of the query text field.
Returns
boolean false if the SearchView should perform the default action of showing any suggestions if available, true if the action was handled by the listener.

onQueryTextSubmit

Added in API level 11
boolean onQueryTextSubmit (String query)

当用户提交查询时调用。 这可能是由于按键盘上的按键或按下提交按钮。 侦听器可以通过返回true来覆盖标准行为,以表明它已处理提交请求。 否则,返回false让SearchView通过启动任何关联的意图来处理提交。

Parameters
query String: the query text that is to be submitted
Returns
boolean true if the query has been handled by the listener, false to let the SearchView perform the default action.

Hooray!