Questions about the soft keyboard popup

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.