Reputation: 3739
I'm using v3.7.0 and I want to change the AndroidManifest.xml when I build my app. Currently I have tried changing the my-project-path/config.xml
file adding the the following lines:
Option a.
<widget>
<preference name="android-manifest/application/activity/@android:windowSoftInputMode" value="adjustPan" />
</widget>
Option b.
<widget>
<preference name="android-windowSoftInputMode" value="adjustPan" />
</widget>
Then I do:
$ ionic cordova build android
And I was expecting the following change on my-project-path/platform/android/AndroidManifest.xml
:
<manifest>
<application>
<activity android:windowSoftInputMode="adjustPan">
</activity>
</application>
</manifest>
But I get the same result as without adding the preference settings:
<manifest>
<application>
<activity android:windowSoftInputMode="adjustResize">
</activity>
</application>
</manifest>
How can I apply the desired effect to the AndroidManifest.xml?
Thanks!
Upvotes: 5
Views: 16092
Reputation: 1483
It looks like AndroidManifest.xml is something that's get derived from config.xml and not something you would want to directly edit.
I would edit config.xml and sections of it are reflected into the various AndroidManifest.xml used for building Android APKs
Upvotes: -2
Reputation: 3739
I found how to do it. If your Cordova version is above 6.4.0 you can use the tag <edit-config>
(http://cordova.apache.org/docs/en/7.x/plugin_ref/spec.html#edit-config) and I think that if you are using the latest version of Ionic probably you'll have a Cordova version above 6.4.0 (I have 7.1).
So the way to make the desired change that I wanted I had to set the my-project-path/config.xml
file as follows:
<widget xmlns:android="http://schemas.android.com/apk/res/android">
<platform name="android">
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity">
<activity android:windowSoftInputMode="adjustPan" />
</edit-config>
</platform>
</widget>
Check that the widget has a new attribute.
With this change when I build the Android version the manifest my-project-path/platform/android/AndroidManifest.xml
looks like this:
<manifest>
<application>
<activity android:windowSoftInputMode="adjustPan">
</activity>
</application>
</manifest>
Upvotes: 13