如何让搜索查看的机器人的事件 [英] how to get the events of searchview in android

查看:126
本文介绍了如何让搜索查看的机器人的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我的application.now搜索视图我只是想输入的搜索查看文本框中的文本,并在另一个textview.if我键入的文本显示它并点击一个按钮,我可以做same.but我DNT希望使用任何额外的buttons.i只想当我pressing进入key.plz任何人帮我,显示的结果。(如果乌拉圭回合suggeting任何侦听器PLZ给我提供code)

i am using a search view in my application.now i just want to get the text typed in the searchview textbox and display it on another textview.if i typed the text and click a button i can do the same.but i dnt want to use any extra buttons.i just want to display the result when i am pressing enter key.plz anyone help me..(if u r suggeting any listeners plz provide me code)

推荐答案

尝试使用<一个href="http://developer.android.com/reference/android/widget/SearchView.html#setOnQueryTextListener%28android.widget.SearchView.OnQueryTextListener%29">setOnQueryTextListener搜索查看的

smthg这样的:

new SearchView.OnQueryTextListener( ) {
    @Override
    public boolean   onQueryTextChange( String newText ) {
        // your text view here
        textView.setText(newText);
    }

    @Override
    public boolean   onQueryTextSubmit(String query) {
        textView.setText(query);
    }
}

这篇关于如何让搜索查看的机器人的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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