How to hide the keyboard when you start the activation on which there is an EditText or can put focus on another element?

    2 answers 2

    In the manifest, list the property for your activation: android:windowSoftInputMode="stateHidden"

    • thanks, it worked! - Taras Zhupnik

    You can hide the keyboard as follows:

     InputMethodManager inputMethodManager = (InputMethodManager) YourActivity.this.getSystemService(Activity.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(YourActivity.this.getCurrentFocus().getWindowToken(), 0); 

    And if you want to remove the focus from EditText , then add two attributes to the container in which it is located:

     android:descendantFocusability="beforeDescendants" android:focusableInTouchMode="true" 

    In general, it is strange, when the application starts, I have a focus on EditText , but the keyboard does not automatically open.

    • Crashes programmatically, and through xml, nothing beckons. Thanks, info is also useful - Taras Zhupnik