问题
I'm facing an issue in which the Android soft keyboard is appearing over the last edittext field on the page. Suggested solutions include changing the windowSoftInputMode, so I added the following preference in the config.xml file:
<preference name="android-windowSoftInputMode" value="adjustResize|stateHidden" />
However, after I do my build, the AndroidManifest.cordova.xml file in the release folder always has a windowSoftInputMode of "adjustResize" and thus nothing changes when I run the app.
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="CordovaApp" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Does anyone know if this setting can be overridden and if so, what the mechanism is for doing so? I'm using Visual Studio (2013 Update 4) Tools for Apache Cordova CTP3.
回答1:
I've had a similar issues in the past, here's how i solved it.
Create a custom AndroidManifest.xml file in the res\native\android folder. All the info in this file will get copied to the debug folder (and will overwrite what is contained in the config.xml file) when you do a build for Android Platform.
Here's a link to the MSDN documentation which has alot more info about custom configurations for the different platforms:
https://msdn.microsoft.com/en-us/library/dn757053.aspx
来源:https://stackoverflow.com/questions/28352244/overwriting-windowsoftinputmode-preference-in-visual-studio-tools-for-apache-cor