Screen is resized on EditBox's editing

Screen is resized on EditBox's editing
0

I have a problem with EditBox. The game’s orientation is portrait.

On Android, when editing begins, the whole screen is resized (half-sized) in the upper position, and virtual keyboard appears below it.
Is it possible to keep the screen size same (and same location), and virtual keyboard appears over it?

Thanks in advance.

Which creator version do you use?

I use v1.5.0.

How about call this method cc.view.resizeWithBrowserSize(false); before editing start?

On Android, the problem was solved.
But on iPhone, the screen content is scrolled when focused. Do you have any idea?

Does the scroll affect the visibility of Editbox?

On some iOS version, eg 9.x , the virtual keyboard doesn’t push the game screen up, so we add a hack to scroll the screen.

I would like to prevent the screen from scrolling. In my game, the keyboard should be located over the screen which has enough room for the virtual keyboard.

so you could tweak the engine by yourself.

in CCSGEditBox.js, there is a function like this:

function adjustEditBoxPosition (editBox) {
    var worldPos = editBox.convertToWorldSpace(cc.p(0,0));
    var windowHeight = cc.visibleRect.height;
    var windowWidth = cc.visibleRect.width;
    var factor = 0.5;
    if(windowWidth > windowHeight) {
        factor = 0.7;
    }
    setTimeout(function() {
        if(window.scrollY < SCROLLY && worldPos.y < windowHeight * factor) {
            var scrollOffset = windowHeight * factor - worldPos.y - window.scrollY;
            if (scrollOffset < 35) scrollOffset = 35;
            if (scrollOffset > 320) scrollOffset = 320;
            window.scrollTo(scrollOffset, scrollOffset);
        }
    }, TIMER_NAME);
}

you could add some logic to prevent screen move on iOS:

cc.sys.os === cc.sys.OS_IOS

I got the same problem with the screen size and this didn’t fixed it. What can I do ?

Any one can fix this problem, What can i do?

Still getting this problem on Cocos Creator V 2.1.0 for Android.

When EditBox is in focus, the native keyboard pops out, pushing the entire canvas up instead of coming over it as an overlay.

Any advice?

Any update about this topic?