input field hidden when soft keyboard appears in phonegap

后端 未结 8 960
失恋的感觉
失恋的感觉 2020-12-03 12:41

Creating a mobile application using Phonegap 3.6.3 for Android and iOS. The problem is only for Android, as iOS acts as I would like it to.

When I click on an input

8条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 13:34

    I too had the same problem - the underlying problem it seems is you can't edit the androidManifest file with cordova Build. All you can do is edit the config.xml file which really only allows you to change a limited subset of settings. What I would like is to be able to change the windowSoftInputMode.

    I did find a solution to my problem. which was the keyboard appearing over fields at the bottom of the screen which I think is the same problem you're having. I have used the cordova 2.9.0 and cordova 3.6.0

    Solution 1: The solution I found was to change this setting in config.xml

    
    

    This does with that setting set to "false" instead of "true" - the page now scrolls up to reveal the field you're editing when the keyboard opens. (to be more accurate, I believe the viewport changes rather than scroll up. Hope you are right on your viewport part)

    Solution 2: Try remove or replace this line from config.xml

    
    

    as

    
    

    instead. This works for me now.

    Solution 3: Try adding this style to your page

    
    

    EDIT:

    If your are using jQuery you can try that.

    $('input, textarea, button, a, select').off('touchstart mousedown').on('touchstart mousedown', function(e) {
        e.stopPropagation();
    });
    

提交回复
热议问题