One, configure in the list
<activity android:windowsoftinputmode= "Statevisible|adjustresize"/>
Meaning of each value:
"1" stateunspecified: The state of the soft keyboard is not specified, the system will select an appropriate state or a theme-dependent setting
"2" stateunchanged: When this activity appears, the soft keyboard will remain in the previous activity, whether it is hidden or displayed
"3" Statehidden: When the user chooses activity, the soft keyboard is always hidden
"4" Statealwayshidden: When the Activity main window gets the focus, the soft keyboard is always hidden
"5" statevisible: Soft keyboard is usually visible
"6" statealwaysvisible: When the user chooses activity, the soft keyboard always displays the state
"7" adjustunspecified: Default setting, usually determined by the system to hide or show
"8" adjustresize: The activity always adjusts the screen size to allow space for the soft keyboard
"9" Adjustpan: The contents of the current window will automatically move so that the current focus is never covered by the keyboard and the user can always see the part of the input content
Second, configure in the code
Method 1:
In OnCreate (), this. GetWindow (). Setsoftinputmode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Method 2:
Hide IME
Inputmethodmanager IMM = (inputmethodmanager) getsystemservice (Context.input_method_service);
Imm.hidesoftinputfromwindow (Myedit.getwindowtoken (), 0); Myedit is a edittext that needs to be banned from automatically ejecting the soft keyboard
Method 3:
Hide IME
Inputmethodmanager IMM = (Inputmethodmanager) getapplicationcontext (). Getsystemservice (Context.input_method_ SERVICE);
Imm.togglesoftinput (0, inputmethodmanager.hide_not_always);
Note:
Togglesoftinput (whether or not shown, hidden);
This method converts the display state of the software input method to the form. If the IME is currently in display state, the method sets the IME to be hidden. If the IME is currently hidden, the method sets the IME display.
Interaction of the interface with the soft keyboard in Android