Android WebView Soft Keyboard will obscure the input box related issues

Source: Internet
Author: User

To realize this soft keyboard will automatically put the layout of the input box on top of the effect, you need to set the Input method properties, there are the following two ways to set:

One, set the following in the Java code:GetWindow (). Setsoftinputmode (windowmanager.layoutparams.soft_input_adjust_resize|WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);The properties of the activity in Androidmanifest.xml are set as follows: Android:windowsoftinputmode= "Adjustresize"

Android:windowsoftinputmode = "Adjustresize", when the soft keyboard pops up, to re-layout the main window layout, and call the Onsizechanged method,
Remember that when we set the "Adjustresize", our interface is not set to full-screen mode, otherwise setting this property will not have any effect. And when we set
Android:windowsoftinputmode = "Adjustpan", the main window will not call the Onsizechanged method, part of the interface will be covered by the soft keyboard,
Will not be squeezed onto a soft keyboard.

  under normal circumstances, when this property is set, the input box is not obscured when the soft keyboard pops up.However, this property does not take effect in some cases, and what I am now aware of is the following Two cases

First, the current activity Full-screen properties are set, i.e.Android:theme= "@android: Style/theme.black.notitlebar.fullscreen"Second, the relative layout of the webview is fixed height, here is also divided into two situations:1. The root layout is fixed to a height, where the root layout is the outermost layout of the activity where the webview resides; 2. The root layout is not fixed height, but the root layout is FramelayoutLayout, and WebView or its parent control is fixed to a height.

The above two fixed height will cause the soft keyboard to block the input box problem, need to pay extra attention.
PS: fixed height, refers to the Layout_height attribute is given to the specific number of DP or PX.

Android WebView Soft Keyboard will obscure the input box related 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.