I\'m using Cordova 5.4.0 and I have this in my config.xml
:
The android-windowSoftInputMode
preference seems to be supported by Phonegap only, not Cordova.
Workaround 1 (Cordova 6.4+): use edit-config
Make sure the xmlns:android="http://schemas.android.com/apk/res/android"
namespace attribute is included in the widget
element and add an edit-config element:
...
...
Workaround 2 (prior to Cordova 6.4): use a plugin
Add the cordova-custom-config plugin:
cordova plugin add cordova-custom-config
Add the following preference:
...
Workaround 3: add a before_build hook
Add the following hook to config.xml:
Add a file appBeforeBuild.js to the scripts directory with the following content:
#!/usr/bin/env node
var fs = require('fs');
var path = require('path');
var pathToManifest = path.join(__dirname, '../platforms/android', 'AndroidManifest.xml');
if(fs.existsSync(pathToManifest)) {
var config = fs.readFileSync(pathToManifest, 'utf8');
var result = config.replace(/(android:windowSoftInputMode=").*?(")/, '$1adjustPan$2');
fs.writeFileSync(pathToManifest, result, 'utf8');
console.log('Set android:windowSoftInputMode to adjustPan');
}
else {
console.log('Could not find AndroidManifest to set android:windowSoftInputMode');
}
This script will use Node to lookup the AndroidManifest and do a regex replace on the android:windowSoftInputMode
attribute (first occurrence only).