Re: [PhoneGap] Android Soft Keyboard Scrolling whole WebView

7,371 views
Skip to first unread message

Adrian Goddard

unread,
Feb 22, 2011, 2:36:30 PM2/22/11
to phon...@googlegroups.com
Try the info on this link:

http://code.google.com/p/jqtouch/issues/detail?id=398

like i say it may not work if u r using sencha but seems like the same issue i had so it might be useful

ade
On 22 Feb 2011, at 19:13, Cameron Perry wrote:

> I think this is a PhoneGap issue…
>
> I'm running a Sencha Touch app in PhoneGap on Android and we're getting this thing where activating a form input brings up the soft keyboard as expected, however the keyboard is pushing the while WebView up the screen, thus hiding the form element. This isn't consistent with webkit where the keyboard slides over the web page.
>
> Any ideas how to fix this?
>
> Thanks,
> Cameron
>
> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com

Adrian Goddard

unread,
Feb 22, 2011, 2:32:04 PM2/22/11
to phon...@googlegroups.com
ah yes i hit this!!! :) although my fix was based on using jqtouch!

I had to modify the css to resolve. I do not have my code to hand but it related to I believe 2 properties set to the body element. I will dig it out tomorrow...but seeing as u r not using jqtouch it may not fix it....but then again it might

Cameron Perry

unread,
Feb 22, 2011, 2:13:43 PM2/22/11
to phon...@googlegroups.com

Sam Croft

unread,
Feb 23, 2011, 7:04:20 AM2/23/11
to phonegap
I had the same problem, Cameron. The soft keyboard seems to add the
overall document height, pushing everything up as your describe.

It really depends on what, if any, framework you're using. But my
'fix' for use with jQtouch was to automatically scroll to the top of
the document (on pages that had no scrolling) or a position on the
page (for pages with scrolling), whenever a field was blur()'d.

Something to the effect of;

$('input').blur(function(){
window.scrollTo(0, 0);
});

...which will fire whenever the soft keyboard goes off screen. You
still see the page move up with the keyboard, but it does at least
return the document to it's normal position when the keyboard is
hidden.

Hope that helps,

- Sam
--
http://twitter.com/samcroft

Michael Herger

unread,
Feb 23, 2011, 8:29:00 AM2/23/11
to phon...@googlegroups.com
I added the following lines to my Android project (inside onCreate()),
which seems to fix the problem:

WebSettings settings = appView.getSettings();
settings.setSupportZoom(false);

Michael


--

Michael

Cameron Perry

unread,
Mar 1, 2011, 7:54:28 PM3/1/11
to phonegap
I think I at least found a work-around for my situation: I had to
remove a docked toolbar and a panel with just HTML that appeared
between the top of the screen and the form. Once those two items were
removed, the text field and the OS input aligned perfectly again. It's
not the best solution, but it works.

~Cameron

On Feb 23, 5:29 am, "Michael Herger" <mich...@herger.net> wrote:
> I added the following lines to my Android project (inside onCreate()),  
> which seems to fix the problem:
>
>         WebSettings settings = appView.getSettings();
>         settings.setSupportZoom(false);
>
> Michael
>

Dan Frist

unread,
Apr 14, 2011, 12:55:23 PM4/14/11
to phonegap
My solution to the soft keyboard nonsense with Phonegap and Sencha
Touch is

in your js file:
Ext.setup({
onReady: function() {
// Just kill the the onwindowresize event because in phonegap the
window won't be resizing except by the keyboard, when sencha doesn't
need to adjust for anyway.
Ext.EventManager.onWindowResize = function() {};

// The rest of your code

and in the android manifest:
android:windowSoftInputMode="adjustResize"

Dan Frist

unread,
Apr 14, 2011, 1:05:28 PM4/14/11
to phonegap
My solution to the android soft keyboard nonsense with Phonegap and
Sencha Touch is

in your js file:

Ext.setup({
onReady: function() {
// Just kill the the onwindowresize event because in
// phonegap the window won't be resizing except
// by the keyboard, when sencha doesn't need to
// adjust for anyway.
Ext.EventManager.onWindowResize = function() {};

// The rest of your code

and in the android manifest:

<activity android:name="<NAME>" android:label="@string/app_name"
<OTHER ATTRIBUTES> android:windowSoftInputMode="adjustResize">

On Feb 23, 9:29 am, "Michael Herger" <mich...@herger.net> wrote:
> I added the following lines to my Android project (inside onCreate()),  
> which seems to fix the problem:
>
>         WebSettings settings = appView.getSettings();
>         settings.setSupportZoom(false);
>
> Michael
>

kio21

unread,
Jul 18, 2011, 2:35:14 AM7/18/11
to phon...@googlegroups.com
I have added for my main application's activity:
android:windowSoftInputMode="adjustPan"
so soft keybord lay above the application main window which is not scrolled up

bipin. sutariya

unread,
Aug 9, 2011, 2:38:22 PM8/9/11
to phonegap
Hi koi21,

Your solution solve my problem.

Thanks

SpNg

unread,
Aug 11, 2011, 4:34:28 PM8/11/11
to phonegap
The best solution I found was to modify the AndroidManifest.xml file
as follows:

<activity android:name=".production"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustNothing">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

The line android:windowSoftInputMode="adjustNothing" is what makes the
keyboard overlay the app, rather than push it up.

Hope this helps.

Alex


On Aug 9, 11:38 am, "bipin. sutariya" <bipin.sutar...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages