I have a modal similar (with fixed positioning) to what facebook has for the comments in feed/chat in messenger in the latest android release. What I want looks similar to this:
So when you focus on the input the keyboard opens and shrinks the webview. It's not working by default and I can't find any solution.
I tried to add this preference to config.xml
but adjustResize
is not doing anything and stateVisible
just opens the keyboard when I start the app.
<preference name="android-windowSoftInputMode" value="stateVisible|adjustResize" />
Which is weird. As of the Android Documentation adjustResize should do this:
The activity's main window is always resized to
make room for the soft keyboard on screen.
I'm using Phonegap 3.0 and I have a Nexus 5 with kitkat for testing.
I have a modal similar (with fixed positioning) to what facebook has for the comments in feed/chat in messenger in the latest android release. What I want looks similar to this:
So when you focus on the input the keyboard opens and shrinks the webview. It's not working by default and I can't find any solution.
I tried to add this preference to config.xml
but adjustResize
is not doing anything and stateVisible
just opens the keyboard when I start the app.
<preference name="android-windowSoftInputMode" value="stateVisible|adjustResize" />
Which is weird. As of the Android Documentation adjustResize should do this:
The activity's main window is always resized to
make room for the soft keyboard on screen.
I'm using Phonegap 3.0 and I have a Nexus 5 with kitkat for testing.
Share Improve this question edited Feb 14, 2014 at 19:27 Adam Halasz asked Feb 14, 2014 at 15:52 Adam HalaszAdam Halasz 58.3k67 gold badges153 silver badges216 bronze badges 1- I am not aware of how config.html gets pulled into the AndroidManifest.xml, but should android-windowSoftInputMode not be android:windowSoftInputMode? Have you tried altering the AndroidManifest.xml in the platforms/Android directory to have <activity android:windowSoftInputMode="stateVisible|adjustResize" – Matt Gaunt Commented Feb 14, 2014 at 17:18
2 Answers
Reset to default 11On my project created with phonegap 3.0, by default the app was full screen activity and the keyboard hid the app and the app was not resized.
I edited config.xml and set <preference name="fullscreen" value="false" />
, then the app was no more be full screen and when the soft keyboard was opened, the app was resized to fit the rest of the screen.
I found the solution.. for specially "sencha/phonegap/cordova" users.
Edit the Main activity in android manifest file add this attribute.
android:windowSoftInputMode="adjustNothing"
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:windowSoftInputMode="adjustNothing" android:label="@string/app_name" android:launchMode="singleTop" android:name="com.company.appName.MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>