Recently in a project, most of the page is implemented by fragment, need to post function, in the interface part of the EditText, the lower right has a Send button, the following summarizes the problems encountered:
No soft keyboard pop-up and edittext get focus configuration, jump to the post page, EditText automatically get focus, soft keyboard pops up, but occasional pop-up soft keyboard overlay send button case
The workaround is by setting the Activity property in the manifest file as follows, making sure that the soft keyboard pops up as shown on the extrusion, rather than overwriting
<activity android:name= ". Ui.activity.MainActivity" android:label= "@string/app_name" android: Launchmode= "Singletask" android:screenorientation= "Portrait" android:windowsoftinputmode= "adjustResize ">
Refer to Https://developer.android.com/training/keyboard-input/visibility.html to enable the specified EditView to get focus when needed, and to eject the soft keyboard
public void Showsoftkeyboard (view view) { if (View.requestfocus ()) { Inputmethodmanager IMM = ( Inputmethodmanager) Getsystemservice (context.input_method_service); Imm.showsoftinput (view, inputmethodmanager.show_implicit);} }
Note that the function call may not be in the fragment life cycle before, otherwise it will not take effect, try to devolve in OnStart can, Oncreateview not
Questions about the soft keyboard popup