Android How to adjust layout in Full Screen Mode when softkeyboard is visible

前端 未结 25 1754
后悔当初
后悔当初 2020-11-22 03:56

I have researched a lot to adjust the layout when softkeyboard is active and I have successfully implemented it but the problem comes when I use android:theme=\"@andro

25条回答
  •  别跟我提以往
    2020-11-22 04:46

    In my case, this issue started happening once I added Crosswalk to my Cordova application. My app is not used in fullscreen and android:windowSoftInputMode="adjustPan".

    I already had the ionic keyboard plugin in the application, so detecting if the keyboard was up or down was easy thanks to it:

    // Listen for events to when the keyboard is opened and closed
    window.addEventListener("native.keyboardshow", keyboardUp, false);
    window.addEventListener('native.keyboardhide', keyboardDown, false);
    
    function keyboardUp()
    {
        $('html').addClass('keyboardUp');
    }
    
    function keyboardDown()
    {
        $('html').removeClass('keyboardUp');
    }
    

    I tried all of the fixes above but the simple line that ended up doing it for me was this bit of css:

    &.keyboardUp {
            overflow-y: scroll;
    }
    

    Hope this saves you the few days I spent on this. :)

提交回复
热议问题