Android's simple dynamic control of the player's keyboard is as follows:
How to hide a keyboard:
Getwindow (). addflags (
Windowmanager. layoutparams. flag_alt_focusable_im );
Source code comment:
/** Window flag: invert the state
{@ Link # flag_not_focusable}
* Respect to how this window interacts with the current method. That
* Is, if flag_not_focusable is set and this flag is set, then
* Window will behave as if it needs to interact with the input method
* And thus be placed behind/away from it; if flag_not_focusable is
* Not set and this flag is set, then the window will behave as if it
* Doesn' t need to interact with the input method and can be placed
* To use more space and cover the input method.
*/
Public
Static final
Int flag_alt_focusable_im = 0x00020000;
This method will cause all the controls in the interface that need to pop up the keyboard to be unable to display the keyboard.
Of course, when we need to clear this status, we can remove it from the touch event of the input control.
Edittext. setontouchlistener (New ontouchlistener (){
@ Override
Public
Boolean ontouch (view V, motionevent event ){
//
Todo auto-generated method stub
Getwindow (). clearflags (
Windowmanager. layoutparams. flag_alt_focusable_im );
Return
False;
}
});