Hiding the soft keyboard is pain. I use some methods based on having an EditText which gets focus, but in my current app the keyboard keeps popping up at some point where a new fragment is loaded.
I have a method in my helper class, but it does not work for me:
//Hide keyboard
public static void hideSoftKeyboard(Activity activity) {
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}
What I would love is a helper method, I could call from anywhere to hide the soft keyboard. Is this possible, or do I always need the find the EditText which is focused?
Try call this method:
setShowSoftInputOnFocus(false);
In my case it work good:for me works this method:
And in XAML
local: must be defined has an namespace in your xaml xmlns:local="clr-namespace:MobileClients.Droid.Core;assembly=MobileClients.Droid"
And thats it
Try use that code (found it in ru internet segment Habra Habr)
Do something like this pass any edittext id of that activity..it will work for that activty
Try with this
In your AndroidManifest.xml:
This setting will hide soft keyboard when user enters new Activity (even if EditText control gains the focus). Soft keyboard will be shown only when user clicks the edit box control.