Android 2.2 Web View windows moves up when Virtual Keyboard appears

前端 未结 5 1996
半阙折子戏
半阙折子戏 2021-02-10 11:47

I am developing an Application using Phonegap on Android. Everything works fine on OS 2.1 but on OS 2.2 when we click on any input type text field the keyboard appears and whole

相关标签:
5条回答
  • 2021-02-10 12:17

    this behaviour on android 2.2 append when there is one element in page with a "transform" css attribute (like transform: translate3d(0px, 0px, 0px); ) removing those declarations fixed the problem for me. (overflow:hidden also but you can't scroll the app anymore)

    PS: overridding the declarations does not work unfortunatly

    0 讨论(0)
  • 2021-02-10 12:18

    I tried to put following css property and it was working for me on Android 2.2

    html, body{overflow: hidden;}

    Not sure why it is working, but it is working...

    Note: I used "iScroll" plugin for scrolling in my application.

    0 讨论(0)
  • 2021-02-10 12:25

    I've never used PhoneGap but I went to their site and I am to understand that it still works via Eclipse and the ADT; if that's the case then this problem can be solved via the AndroidManifest.xml file by adding the following to your <activity> tag for the activity that is invoking the Soft Keyboard:

    <activity android:windowSoftInputMode="adjustNothing"
              //other flags
    />  
    

    Actually this seems to not be the case. The API document I was reading was actually for Honeycomb, this flag isn't in 2.2. Sorry. All of my work recently has been on tablets and I forgot which version of the SDK I had bookmarked for reading since I've been prepping lately.

    0 讨论(0)
  • 2021-02-10 12:29

    You might have to enable this script to avoid your app scrolling when your text input field gets focus :)

    function preventBehavior(e) 
    { 
      e.preventDefault(); 
    };document.addEventListener("touchmove", preventBehavior, false);
    
    0 讨论(0)
  • 2021-02-10 12:37

    Adding this

    android:windowSoftInputMode="adjustPan"
    

    to your in AndroidManifest.xml will solve the issue

    0 讨论(0)
提交回复
热议问题