Android Soft keyboard popup hidden extrusion interface and other issues

Source: Internet
Author: User

The use of soft keyboard in Android is very much, the following is commonly used in soft keyboard settings;

1, Horizontal screen, click the input box appears the full keyboard solution: In EditText, Searchview and other controls to add


2, vertical screen, Android will appear half screen.
CASE1: Your input box is in the lower position, so the keyboard may block the input box. WORKAROUND: Set the activity in manifest

Android:windowsoftinputmode= "Adjustresize"
This activity's main window will always resize to provide space for the keyboard.
CASE2: Your input box is on the top, normally this will not be a problem, but if you use the vertical aspect of the interface is layout_weight that is the specific gravity to distribute the page,

The software tray compresses the entire window , causing the input box to be partially compressed. WORKAROUND: Set the activity in manifest

Android:windowsoftinputmode= "Adjustpan"
This way the keyboard does not compress the original window, only the following part of the content is obscured. This way the input box is not compressed.

3, just enter an activity, will focus input box, this will be active pop-up soft keyboard, if you do not want to automatically eject, then you can let other unimportant control to get focus, and then a timer

Let EditText get the focus again!


4. Determine if the soft keyboard is currently in a popup state

if (GetWindow (). GetAttributes (). softinputmode==windowmanager.layoutparams.soft_input_state_visible)

5. Manually hide the soft keyboard


6. Manually eject the soft keyboard

((Inputmethodmanager) Getsystemservice (Input_method_service)). Togglesoftinput (0,inputmethodmanager.hide_not_ Always);







Android Soft keyboard popup hidden extrusion interface and other issues

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.