Binoy Babu Binoy Babu -5 years ago 233
Android Question

Disabling SearchView

I'm trying to disable a

SearchView
from my
Activity
. I tried the following code :

mSearchView.setEnabled(false);
mSearchView.setFocusable(false);
mSearchView.setClickable(false);


But it does not work. SearchView can still be clicked and KeyBoard popps up. I want it to become greyed out and unclickable. How can I accomplish this?

Answer Source

To disable any view (e.g. SearchView) either set its input-type to none in layout XML or call view.setInputType(InputType.TYPE_NULL) from the Activity.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download