Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhoneGap android : keyboard overlaps input field

I've an input field in a webview, when clicking on input the keyboard is shown but it comes over the input field. I tried putting windowSoftInputMode="adjustPan" in androidManifest but still the same. When opening the same html page in device's browser everything is ok. Any ideas ?

Regards

UPDATE:

It doesn't have an XML layout, because I use the Phonegap framwork and the Activity extends DroidGap, and it doesn't have a setContentView(xx.xml) method.

public class TestActivity  extends DroidGap {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        setIntegerProperty("loadUrlTimeoutValue", 30000);
        super.loadUrl("file:///android_asset/www/index.html");
    }
}
like image 869
vanshu Avatar asked Jul 13 '12 10:07

vanshu


4 Answers

I seem to have the exact same problem and added

android:windowSoftInputMode="adjustPan"

to the AndroidManifest.xml file as you did. This did not work and finally somebody pointed out to use

android:windowSoftInputMode="adjustResize"

instead. This works for me now. adjustPan seems to make more sense and adjustResize sounds wrong, but it does the job.

like image 106
mackrauss Avatar answered Nov 08 '22 08:11

mackrauss


Try to change preferences fullscreen to false

<preference name="fullscreen" value="false" />

I tried and success!

like image 38
Johnny Avatar answered Nov 08 '22 07:11

Johnny


In phonegap there are preferences for specific device. See configurations on this page: https://build.phonegap.com/docs/config-xml And the solution to change on config.xml is:

preference name="android-windowSoftInputMode" value="stateVisible|adjustResize"
like image 39
Givailson de Souza Neves Avatar answered Nov 08 '22 08:11

Givailson de Souza Neves


It worked for me with the answers combined from above:

<preference name="android-windowSoftInputMode" value="stateVisible|adjustResize"/>

and:

<preference name="fullscreen" value="false"/>
like image 38
Mihaita Tinta Avatar answered Nov 08 '22 07:11

Mihaita Tinta