Android WebView Soft Keyboard will obscure the input box related issues

Source: Internet
Author: User

In order to achieve such a soft keyboard will be on its own initiative to 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:

First, set the following in the Java code, for example:GetWindow (). Setsoftinputmode (windowmanager.layoutparams.soft_input_adjust_resize| WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);Second, set the properties of its corresponding activity in androidmanifest.xml such as the following: Android:windowsoftinputmode= "Adjustresize"

Android:windowsoftinputmode = "Adjustresize" when the soft keyboard pops up. You want to lay out the main form layout again. and call the Onsizechanged method,
Remember that when we set it to "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 form will not call the Onsizechanged method. Part of the interface will be covered by a soft keyboard. On
Will not be squeezed onto a soft keyboard.



Normally, when the property is set, the soft keyboard pops up. The input box will not be obscured.

However, this attribute is not valid in some cases, and now I am aware of the following two scenarios :

First, the current activity is set to full-screen properties. namely android:theme= " @android : Style/theme.blac  K.notitlebar.fullscreen " Two, webview the relevant layout has been 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 is located; c24> 2. The root layout is not fixed height, but the root layout is the framelayout layout. The WebView or its parent control is fixed to a height.



The above two fixed heights will cause the soft keyboard to obscure the input box problem. You need to pay extra attention.
PS: fixed height. means that the Layout_height attribute is given a detailed 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.