Overwriting windowSoftInputMode preference in Visual Studio Tools for Apache Cordova config.xml file

痞子三分冷 提交于 2020-01-03 02:37:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!