Android Keyboard Usage Issues summary

Source: Internet
Author: User

1, Android:windowsoftinputmode1, when the focus is generated, the soft keyboard is hidden or displayed
2. Reduce the size of the active main window to make room for the soft keyboard
2, android:imeoptions= "Actionsearch|flagnofullscreen" in the use of a edittext put into the actionbar as a function of the search box, Setting the EditText property to Android:imeoptions= "Actionsearch", you will encounter a problem, when in the horizontal screen, the width of the edittext will be filled off the screen in addition to the soft keyboard, not to match the requirements, to Android: Imeoptions= "Actionsearch|flagnofullscreen" after the OK.
3. The code sets whether the pop-up keyboard presses the window

Do not squeeze the window:

Getactivity (). GetWindow (). Setsoftinputmode (WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
Squeeze window:

Getactivity (). GetWindow (). Setsoftinputmode (WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

There are four different modes:
Soft_input_adjust_nothing
Soft_input_adjust_pan
Soft_input_adjust_resize
Soft_input_adjust_unspecified

4, sometimes unable to adjust the keyboard

Sometimes it is found that the keyboard cannot be adjusted with the following code:

Inputmethodmanager IMM = (Inputmethodmanager) getactivity (). Getsystemservice (Context.input_method_service); Imm.showsoftinput (MView, 0);

It is possible that the focus has fallen on the other non-edit frame view, and a delay may be good. When the Input method pops up, it detects if the current focus view is valid, and if the non-active focus view is not available, the input method is not ejected.

Mview.postdelayed (New Runnable () {@Overridepublic void run () {Inputmethodmanager IMM = (inputmethodmanager) getactivity (). Getsystemservice (Context.input_method_service); Imm.showsoftinput (MView, 0);}}, 100);



Android Keyboard Usage Issues summary

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.