1. EditText has focus (focusable is true) prevents Input method pop-up
Java code
- edittext= (EditText) Findviewbyid (r.id.txtbody);
- Edittext.setontouchlistener (new Ontouchlistener () {
- Public Boolean OnTouch (View V, motionevent event) {
- Edittext.setinputtype (Inputtype.type_null); //Off soft keyboard
- return false;
- }
- });
2. Prevent Input Method pop-up when Eidttext no focus (Focusable=false)
Java code
- Inputmethodmanager IMM = (inputmethodmanager) getsystemservice (Input_method_service);
- Imm.hidesoftinputfromwindow (Edittext.getwindowtoken (), 0);
1. Call the display system default Input method
Method One,
Java code
- Inputmethodmanager IMM = (inputmethodmanager) getsystemservice (Context.input_method_service);
- Imm.showsoftinput (M_receiverview (view) with soft keyboard input, inputmethodmanager.show_forced (provides markup for the current action, show_forced indicates force display) );
Method Two,
Java code
- Inputmethodmanager m= (Inputmethodmanager) Getsystemservice (Context.input_method_service);
- M.togglesoftinput (0, inputmethodmanager.hide_not_always); (This method can implement the input method to switch the display on the window, if the input method is already displayed on the window, then hide, if hidden, then display the input method to the window)
2. Call the hidden system default Input method
Java code
- ((Inputmethodmanager) Getsystemservice (Input_method_service)). Hidesoftinputfromwindow (WidgetSearchActivity. This.getcurrentfocus (). Getwindowtoken (), inputmethodmanager.hide_not_always); (Widgetsearchactivity is the current activity)
3. Get the Input Method open state
Java code
- inputmethodmanager imm = (Inputmethodmanager) GetSystemService ( Context.input_method_service);
- boolean isopen=imm.isactive ();
- isopen if return true, the Input method opens
Original: http://sunxin1001.iteye.com/blog/854182
http://getcn.net/index.php?mod=skill&action=detail&id=43978
Other than that
Parameter meaning
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
The soft keyboard covers the activity directly, which is usually the default value
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
The activity height changes, letting out the soft keyboard space. and WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN to 2 for the value of 1
WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE
The activity displays the Soft keyboard window directly when it is opened, if that window is needed (i.e., a edittext or ditable control)
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN
When the activity is open, the Soft keyboard window is not displayed directly until the user touches the text box himself.
Android Development: Turn off the soft keyboard in EditText