Solve the problem of the Android soft keyboard blocking the input box

Source: Internet
Author: User

When the input box is too large in the layout design of Android, the input box below will be partially blocked by the software disk when the soft keyboard is entered, so the focus input cannot be obtained.

The following three solutions are available:

method One: in your activity in the corresponding Java file OnCreate in Setcontentview before writing this code GetWindow (). Setsoftinputmode ( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/53/C0/wKioL1Ru5UbhlbzMAAE50gyiomg583.jpg "title=" Untitled. png "alt=" wkiol1ru5ubhlbzmaae50gyiomg583.jpg "/> This method is the simplest

method Two: in the project's Androidmanifest.xml file interface corresponding to the <activity> add android:windowsoftinputmode= "statevisible| Adjustresize ", this will make the screen move up the whole. If you add a android:windowsoftinputmode= "Adjustpan", the keyboard will overwrite the screen.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/53/C0/wKioL1Ru5e6wd3w-AAKybsfW-T4122.jpg "title=" Untitled. png "alt=" wkiol1ru5e6wd3w-aakybsfw-t4122.jpg "/>


method Three: replace the top layout with ScrollView, or add a layer of ScrollView to the top layout. This will roll the soft keyboard and the input box together, and the soft keyboard will always be at the bottom.

Add ScrollView outside of our linearlayout layout


This article is from the "Dapeng Wings" blog, please be sure to keep this source http://4812587.blog.51cto.com/4802587/1580907

Solve the problem of the Android soft keyboard blocking the input box

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.