Android : Disable soft keyboard in SearchView Android

on Wednesday, March 18, 2015


I have created a custom keyboard which I want to use whenever my SearchView is active. Right now, the custom keyboard appears underneath the default soft keyboard. I can't seem to get it to hide properly.


I have used the InputMethodManager to try to hide it with hideSoftInputFromWindow. At first click on the SearchView this does not seem to have any effect. But if I try to touch the SearchView a few more times, the touch is recognized as an onTouch event, and the default keyboard is hidden (I have defined the InputMethodManager in an onTouchlistener).


I have tried to put android:windowSoftInputMode="stateAlwaysHidden" in the Manifest under the activity tag. Did nothing.


I have set the input type of the SearchView to null, no success.


It seems the SearchView overrides my code when it is first focused. Does anyone have a workaround for this?


0 comments:

Post a Comment