Skip to content

[SearchView] Undocumented how to actually use it #4189

@rafrafek

Description

@rafrafek

There is no documentation on how to use com.google.android.material.search.SearchView.

There is no setOnQueryTextListener, but all tutorials on the internet say it should be there.

There is no information on how to listen to the search input text changes. It's the most basic thing and without it the component is useless.

Google Gemini does not know the answer. ChatGPT4 does not know the answer.

I had to search the entire internet to find the answer:
https://stackoverflow.com/a/78060915/9737275

The answer is that searchView has a secret child editText that you can add a text change listener to. Please mention it in the documentation.

searchView.editText.addTextChangedListener

There is also no documentation on how to actually use it, e. g. with RecyclerView. It would be great to have it.

Thank you.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions