Theresa Gamit Theresa Gamit - 4 years ago 164
Android Question

How to disable searchview?

Can you help me on how to disable searchview when button is pressed? I'm trying this code:

searchView.setEnabled(false);
searchView.setFocusableInTouchMode(false);
searchView.clearFocus();


but it seems not working. I can still input text in searchview.

Thanks.. :))

Answer Source

You can use:

searchView.clearFocus();

and if you want to hide it using:

searchView.setVisibility(View.GONE);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download