androidcordovaandroid-virtual-keyboard

Android+PhoneGap: android:windowSoftInputMode doesn't seem to work


I'm developing a PhoneGap-based application and I googled much about how to make my webview adjust its height when virtual keyboard appears, or at least get height of the virtual keyboard. I found a lot of posts (including stackoverflow) which says that

android:windowSoftInputMode="adjustResize"

must be set in the manifest and I did that. I also found that for PhoneGap config.xml there's

<preference name="android-windowSoftInputMode" value="adjustResize"/>

setting and I pasted that too. I also tried combined value 'stateVisible|adjustResize' (not just 'adjustResize') for both parameters, but it seems to me that they both have NO EFFECT. I don't know, maybe I'm doing something wrong, but you can check the screenshots from the emulator (Android 4.0.3, but I also tried 4.1.2 and 4.2.2):
http://screencast.com/t/Mm0mw8c693 - keyboard visible
http://screencast.com/t/lZ2DomqeRR - keyboard hidden
On the screenshot I intentionally captured my manifest and config.xml settings, so you may see they're actually there.
I even recorded short video - http://screencast.com/t/xI9PMcMJxxx

As you may see, no any viewport resizing occur when keyboard shown / hidden. I also checked window.innerHeight using console.log() and it stays same for both visible and hidden keyboard.

Please, give me some advice.


Solution

  • windowSoftInputMode="adjustResize" does not work if your app is in fullscreen mode (setting fullscreen to true in config.xml). It is Android's issue not Cordova. the issue CB-4404 was filed in Cordova bug tracker for months but recently it turns out that it is working as intended on Android bug tracker.

    I solved the problem by setting fullscreen to false since it wasn't a problem for my app not to go fullscreen.