how to get the events of searchview in android

后端 未结 6 892
傲寒
傲寒 2020-12-15 04:58

I\'m using a search view in my application. Now i just want to get the text typed in the SearchView text box and display it on another textview. If i typed the text and clic

6条回答
  •  猫巷女王i
    2020-12-15 05:20

    In Kotlin, you can do :

    searchView.setOnQueryTextListener(object : OnQueryTextListener {
    
        override fun onQueryTextChange(newText: String): Boolean {
            return false
        }
    
        override fun onQueryTextSubmit(query: String): Boolean {
            // task HERE
            return false
        }
    
    })
    

提交回复
热议问题