如何更改android SearchView文本 [英] how to change android SearchView text
本文介绍了如何更改android SearchView文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有用于SearchView的setText()方法或类似的方法? 我尝试像这样在searchView中设置搜索文本,但是没有这样的方法.
Is there a setText() method for SearchView or something like that? I try to set the search text in the searchView like this but there is no method for like this.
searchView.setText(searchToken);
推荐答案
在想了一下之后,我发现API中有一个名为setQuery()的方法,您可以设置searchView文本,然后可以选择提交搜索或不使用boolean参数.
After wondering and trying I found out that there is a method in the API named setQuery() which you set the searchView text and you may choose to submit the search or not using the boolean parameter.
searchView.setQuery(searchToken, false);
这篇关于如何更改android SearchView文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文